PHP
Convert print_r result to JSON
As you know json_encode is encoding only array or public properties of an object. But print_r can expose the protected and private properties in an object. Sometimes we need to these hidden properties. For this purpose we can convert print_r result to JSON result. Here is the function we need: if (!function_exists(‘pr2json’)) Devamı…