
Originally Posted by
Selkirk
How about anonymous objects? Think PHON as in JSON.
PHP's builtin arrays are hashmaps already - so no need for that, although a prettier syntax for literal arrays would be nice. It would be nice though if arrays could be treated transparently as objects without explicit typecasting, a la SPL ArrayObject. Eg. making the following syntax valid:
PHP Code:
$a = Array('foo' => "bar");
echo $a->foo; // yields bar
And in that case, perhaps object properties should be available with array syntax as well:
PHP Code:
$o = new StdClass();
$o->foo = "bar";
echo $o['foo']; // yields bar
Bookmarks