I created a array using PHP
$userarray = array('UserName'=>$username,'UserId'=>$userId,'UserPicURL'=>$userPicURL);
How can I convert this array into a string in PHP and back from string into an array. This is kind of a requirement. Could someone please advice on how this can be acheived.
You can convert any PHP data-type but resources into a string by serializing it:
And back into it’s original form by unserializing it again:
A serialized array is in string form. It can be converted into an array again by unserializing it.
The same does work with
json_encode/ –_decodefor your array as well: