php parse print_r output

后端 未结 1 1270
陌清茗
陌清茗 2021-01-23 08:44

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

相关标签:
1条回答
  • 2021-01-23 09:01

    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.

    0 讨论(0)
提交回复
热议问题