3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $vars = array(); function assign ($var, $value) { global $vars; $vars[$var] = $value; } $a = new stdClass; $a->x = 3; assign('a', $a); $a->x = $a->x + 1; var_dump($vars);
Output for 5.0.0 - 7.1.0
array(1) { ["a"]=> object(stdClass)#1 (1) { ["x"]=> int(4) } }
Output for 4.3.0 - 4.4.9
array(1) { ["a"]=> object(stdClass)(1) { ["x"]=> int(3) } }