- var_dump: documentation ( source)
- json_decode: documentation ( source)
- preg_replace: documentation ( source)
- json_encode: documentation ( source)
<?php
function e($o){return json_decode(preg_replace('/\\\u0000[*a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\\\u0000/','',json_encode((array)$o)),1);}
class Foo
{
public function test()
{
echo 'test';
}
}
function changeMe(&$obj)
{
$obj = function(){
echo 'hello';
};
//$reflectionClass = new ReflectionClass($obj);
//var_dump($reflectionClass);
$arr = (array) $obj;
$obj = (object) $arr;
var_dump($arr, $obj);
//$out = json_encode($arr);
//$out = preg_replace('/\\\u0000[*a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\\\u0000/', '', $out);
//echo $out . PHP_EOL;
//$newArray = json_decode($out, true);
//var_dump($arr, $newArray);
}
$foo = new Foo();
changeMe($foo);
$foo->test();