I want to serialize a multidimension array in php:
$arr['foo'] = array('bar'=>'foo');
I'm going to pass $arr to an eval function and so i needed it to be serialized. When eval runs, it actually passes this as an argument to a class method, call it helper method, this helper method then takes that argument and converts it back to a real array the problem is when i report $arr['foo']['bar'] i get :
Fatal error: Cannot use string offset as an array in...
and when i access it by: $arr[0] i get :
a
apparently the letter a in the string "array".. so when i return print_r($arr) i get :
array
I get no problem with simple one-dimensional arrays since serializing $vehicle['foo']
would let me do return $vehicle['foo']
very well.