When doing stdClass in PHP we can do it this way:
// Create new stdClass Object
$init = new stdClass;
// Add some test data
$init->foo = "Test data";
$init->bar = new stdClass;
$init->bar->baaz = "Testing";
$init->bar->fooz = new stdClass;
$init->bar->fooz->baz = "Testing again";
$init->foox = "Just test";
Is there any other alternative way to do with so that it looks cleaner like we can do with JavaScript?
Thanks.
$array = array('x'=>123);
$object = (object) $array;