3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $bar; public function &__get($property) { return $this->bar; } public function __set($property, &$value) { $this->bar = &$value; } } $test = new Foo; $a = 0; $test->bar = $a; $a++; echo $test->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/HQX0E on line 14
Process exited with code 255.

preferences:
189.95 ms | 1395 KiB | 57 Q