3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $x = new stdClass; $x->a = 1; $_SESSION['x'] = $x; function smth() { $x = $_SESSION['x']; return $x; } print_r($x); $y = smth(); $y->y = 'A'; print_R($x); print_R($_SESSION['x']);
Output for 5.0.0 - 7.1.0
stdClass Object ( [a] => 1 ) stdClass Object ( [a] => 1 [y] => A ) stdClass Object ( [a] => 1 [y] => A )
Output for 4.3.0 - 4.4.9
stdClass Object ( [a] => 1 ) stdClass Object ( [a] => 1 ) stdClass Object ( [a] => 1 )