<?php class Foo { protected $foo; function bar() { return $this->foo = new stdClass; } } $x = new Foo; $y = 'baz'; $x->bar()->$y = 'zing'; var_dump( $x );
You have javascript disabled. You will not be able to edit any code.