3v4l.org

run code in 300+ PHP versions simultaneously
<?php $listBinder = new class () { private $refs; function bind(&$p1, &$p2, &$p3) { $this->refs = [&$p1, &$p2, &$p3]; [$p1, $p2, $p3] = range(4, 6); } function change() { $this->refs[0] = 42; $this->refs[1] = 'foo'; $this->refs[2] = 'turtles all the way down'; } }; $list = [null, null, null]; $listBinder->bind(...$list); var_dump($list); $listBinder->change(); var_dump($list);

preferences:
63.97 ms | 402 KiB | 5 Q