- json_decode: documentation ( source)
- print_r: documentation ( source)
- var_export: documentation ( source)
<?php
$o = json_decode("{}");//new stdClass;
$id = -99;
$a = array('id' => $id, 'name' => 'bill');
$o->$id = $a;
$b = eval(var_export($o, true));
print_r($b);