PHP array to text and back to array

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
willsherwoodAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
GaryConnect With a Mentor Commented:
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
 
Gregory MillerConnect With a Mentor General ManagerCommented:
I would use serialization. Here is a link from the PHP manual: http://www.php.net/manual/en/language.oop5.serialization.php
0
 
willsherwoodAuthor Commented:
a POST array is constructed by the web browser i would suppose.
0
 
willsherwoodAuthor Commented:
both excellent approaches i was not aware of.
thanks!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.