3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $bar; public function &__get($property) { echo 'get'.PHP_EOL;; switch ($property) { case 'bar': return $this->bar; //etc. } } public function __set($property, &$value) { echo 'set'.PHP_EOL; switch ($property) { case 'bar': $this->bar = &$value; break; //etc. } } } $foo = new Foo(); $baz = 1; $foo->bar = &$baz; echo $foo->bar;
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.21
Fatal error: Method Foo::__set() cannot take arguments by reference in /in/RADOq on line 27
Process exited with code 255.

preferences:
186.21 ms | 1395 KiB | 57 Q