Page 1 of 1

Convert array to string

Posted: Wed Mar 20, 2013 8:50 pm
by FrederickGeek8
Is there some way to convert an array to something that is transmitable and reverable? So it could be like
[syntax=php]$array = array('hey', 'what', 'is', 'up');
//convert to string
$array = function($array);
echo $array;
// equals something non-human readable
// ex asdklj92vlkan1kljdfvj2
$array = reverse($array);
print_r($array);
// returns 'hey', 'what', 'is', 'up'[/syntax]

Re: Convert array to string

Posted: Wed Mar 20, 2013 11:08 pm
by Temor
Wouldn't that just be encrypting?
I guess there are plenty of functions for that, and millions of ways to do it.

Re: Convert array to string

Posted: Fri Mar 22, 2013 4:11 pm
by FrederickGeek8
It doesn't need to be secure or anything. What I ended up doing is
[syntax=php]base64_encode(serialize($array))[/syntax]