3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test(stdClass &$obj) { var_dump($obj); $obj = 'lol'; } $o = new stdClass; $o->prop = 'foo'; test($o); var_dump($o);
Output for 7.4.33, 8.2.25 - 8.2.26, 8.3.5 - 8.3.14, 8.4.1
object(stdClass)#1 (1) { ["prop"]=> string(3) "foo" } string(3) "lol"

preferences:
28.74 ms | 406 KiB | 5 Q