3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // $baz = 'baz'; function foo(&$var, $x) { echo $GLOBALS["baz"]; $var =& $x; } $bar = 'bar'; foo($bar); var_dump($bar, 5);
based on SvkX9
Output for 7.1.0 - 7.3.0rc3
Fatal error: Uncaught ArgumentCountError: Too few arguments to function foo(), 1 passed in /in/pTnZn on line 9 and exactly 2 expected in /in/pTnZn:4 Stack trace: #0 /in/pTnZn(9): foo('bar') #1 {main} thrown in /in/pTnZn on line 4
Process exited with code 255.
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.0.20
Warning: Missing argument 2 for foo(), called in /in/pTnZn on line 9 and defined in /in/pTnZn on line 4 Notice: Undefined index: baz in /in/pTnZn on line 5 string(3) "bar" int(5)
Output for hhvm-3.15.4
Warning: foo() expects exactly 2 parameters, 1 given in /in/pTnZn on line 5 string(3) "bar" int(5)