3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface FooInterface { public function get(); } class Foo implements FooInterface { protected $thing = 5; public function &get() { return $this->thing; } } $foo = new Foo(); $thing1 = $foo->get(); $thing1 = 6; var_dump($foo->get()); $thing2 = &$foo->get(); $thing2 = 7; var_dump($foo->get());

preferences:
57.01 ms | 402 KiB | 5 Q