$array = (object)array(
'name' => 'David',
'friends' => (object)array(
(object)array('name' => 'Max'),
(object)array('name' => 'Jian')
)
);
var_dump($array);
I want to learn how to use stdClass function to get the same result, don't want to use (object) before each array, convert cause some resource, and I know json_encode and json_decode can make it, just want to learn how stdClass make nested structure.
object): Create an array,json_encodeit, andjson_decodethe resulting JSON. :P Next closest: Create an array and then recursively objectify it.