- var_dump: documentation ( source)
- json_decode: documentation ( source)
- preg_replace: documentation ( source)
- json_encode: documentation ( source)
<?php
namespace Cheese\Topping\Please {
class Foo
{
public $bar = 'barValue';
protected $baz = 'bazValue';
private $biz = 'bizValue';
}
$foo = new \Cheese\Topping\Please\Foo();
$arrayFoo = (array) $foo;
$out = json_encode($arrayFoo);
echo $out . "\n\n";
$out = preg_replace('/\\\u0000[*a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\\\u0000/', '', $out);
$newArray = json_decode($out, true);
var_dump($newArray);
}