3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo($object) { $object = null; } function bar(&$object) { $object = null; } $o = new stdClass(); var_dump($o); foo($o); var_dump($o); bar($o); var_dump($o);
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.21, 7.4.0 - 7.4.9, 8.0.0alpha1 - beta1
object(stdClass)#1 (0) { } object(stdClass)#1 (0) { } NULL