Convert array to string

Ask about a PHP problem here.
Post Reply
User avatar
FrederickGeek8
Posts: 148
Joined: Wed Nov 30, 2011 10:31 pm

Convert array to string

Post by FrederickGeek8 »

Is there some way to convert an array to something that is transmitable and reverable? So it could be like
$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'
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Convert array to string

Post by Temor »

Wouldn't that just be encrypting?
I guess there are plenty of functions for that, and millions of ways to do it.
User avatar
FrederickGeek8
Posts: 148
Joined: Wed Nov 30, 2011 10:31 pm

Re: Convert array to string

Post by FrederickGeek8 »

It doesn't need to be secure or anything. What I ended up doing is
base64_encode(serialize($array))
Post Reply