3v4l.org

run code in 300+ PHP versions simultaneously
<?php function takeRef(&$foo) { $foo = "this is a string now"; } class A { private int $data = 42; public function makeString() { takeRef($this->data); var_dump($this->data); } } $a = new A(); $a->makeString();

preferences:
41.23 ms | 402 KiB | 5 Q