3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = new stdClass; $b = $a; $a->foo = 'bar'; var_dump($b); /* Notice at this point, that $a and $b are, * indeed sharing the same object instance. * This is their reference-like behavior at work. */ $a = 'baz'; var_dump($a); var_dump($b); /* Notice now, that $b is still that original object. * Had it been an actual reference with $a, * it would have changed to a simple string as well. */ ?>

preferences:
36.26 ms | 402 KiB | 5 Q