When you get some database record using PHP extensions of 3rd party libraries you know that some of them return an array and some other return object, during web development I have to cast such object to array and vice versa, or at least remember that foo is array and boo is object and using proper syntax to access the record attributes. This is annoying and I think perhaps there was a syntax sugar that make it a litter easier, isn't it?
I want access to attributes of a recode regardless of it structure. because we know to following structure have same syntactical power.
$foo = ['a'=>'b','x'=>'y'];
$foo = new stdClass();
$foo->a='b';
$foo->x='y';
In javscript: foo={a:'b',x:'y'};
and then x= foo['a'];
or x= foo.a;
if this is possible in JS why not in PHP?