Thread: String to Array
View Single Post
  #1 (permalink)  
Old September 5th, 2006, 11:12 AM
Psion Psion is offline
Registered User
 
Join Date: Sep 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default String to Array

I was wondering if there was a way to convert a string back into an array, like say:

$foo = array("vegetable" => "apple", "fruit" => "grape");
$array = print_r($foo, true);
$array = string_to_array($array);
print $array['vegetable'];

It's not difficult to create that for me, but when I get into deep multidimensional arrays I'm lost as to how to develop those loops. I can get all the values fine but everything I can think of won't retain the embedded array's key.


Thanks for any help.

Reply With Quote