Solved

PHP array to text and back to array

Posted on 2014-02-18
4
513 Views
Last Modified: 2014-02-18
i want to send an entire POST array thru a single (text) API GET param and
process it (remotely in the API)

what is the best way to "encode" or "compress" or "convert" a PHP array into a text string
such that it can be easily  re-constituted back to the original array at the other end.

thanks
0
Comment
Question by:willsherwood
  • 2
4 Comments
 
LVL 11

Assisted Solution

by:Gregory Miller
Gregory Miller earned 250 total points
ID: 39869170
I would use serialization. Here is a link from the PHP manual: http://www.php.net/manual/en/language.oop5.serialization.php
0
 
LVL 58

Accepted Solution

by:
Gary earned 250 total points
ID: 39869177
How is the array being constructed? In PHP?
You may want to look at json_encode to convert to a string and then in the reverse json_decode to get the string back as an array
0
 

Author Comment

by:willsherwood
ID: 39869196
a POST array is constructed by the web browser i would suppose.
0
 

Author Closing Comment

by:willsherwood
ID: 39869209
both excellent approaches i was not aware of.
thanks!!!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question