3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { public $foo; public function &bar1() { return $this; } public function bar2($o) { $this->bar1() = $o; } } $a = new Foo; $a->foo = 1; $b = new Foo; $b->foo = 2; var_dump($a->foo, $b->foo); $a->bar2($b); var_dump($a->foo, $b->foo);
Output for 5.3.0 - 5.4.8
Fatal error: Can't use method return value in write context in /in/IM44H on line 5
Process exited with code 255.