- 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(){
};
//$reflectionClass = new ReflectionClass($obj);
//var_dump($reflectionClass);
$arr = (array) $obj;
$out = json_encode($arrayFoo);
$out = preg_replace('/\\\u0000[*a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\\\u0000/', '', $out);
$newArray = json_decode($out, true);
var_dump($arr, $newArray);
}
$foo = new Foo();
var_dump($foo);
changeMe($foo);
$foo->test();