after using javascript quite a bit, I am used to
var obj = {};
obj.foo = 1;
obj.bar = “hello”;
etc…
and so in PHP, is the standard way to doing that by
$obj = new stdClass();
$obj->foo = 1;
$obj->bar = “hello”;
? I think $obj = (object) array() can also be used. but probably stdClass() is a more standard way? is there also like an object literal like { } as in javascript? This is kind of like defining an arbitrary object and we can tag on any property… in a less traditional object oriented way where we always define a class and then use $obj = new Animal() i think. In Javascript, associative array and object are actually the same thing… but in PHP, they are different huh? thanks.