3v4l.org

run code in 300+ PHP versions simultaneously
<?php $z = (object)["p" => 1]; $z->p = &$z->p; var_dump($z); $z = (object)["p" => 1]; $z->p = &$z->p; $z->p; var_dump($z);
Output for 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.21, 7.4.0 - 7.4.10, 8.0.0alpha1 - beta3
object(stdClass)#1 (1) { ["p"]=> int(1) } object(stdClass)#2 (1) { ["p"]=> int(1) }
Output for 5.6.38
object(stdClass)#1 (1) { ["p"]=> &int(1) } object(stdClass)#2 (1) { ["p"]=> int(1) }