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; if ($vars['a']->x == $a->x) { print 'By reference'; } else { print 'By value'; }
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
By reference
Output for 4.3.0 - 4.4.9
By value