3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C { private $prop; public function &getProp() { return $this->prop; } public function setProp($value) { echo "Setting \$prop: $value\n"; $this->prop = $value; } } $c = new C(); $c->setProp(42); $prop = &$c->getProp(); $prop++; var_dump($c);

preferences:
15.49 ms | 404 KiB | 5 Q