When I print an object using print_r
, is there any specific utility function in php to convert the output to an object?
There seems to be enough output to
There is no automatic method to change print_r
value back to an object. You are also missing important information like what type is stored at a key (string or number or ..)
You could use var_dump
to get more detailed output that can be changed back to an object. But still this does not mean there is an automatic function for it.
Last you could use var_export
( http://php.net/manual/en/function.var-export.php ) to get valid PHP output you can use.
You could also use http://php.net/manual/en/function.serialize.php to pass objects around.