3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array('a', 'b', 'c'); foreach($array as &$a) { $array = array($a => $array); } var_dump($array);
Output for 5.2.2 - 5.6.28, 7.0.0 - 7.1.0
Warning: Illegal offset type in /in/fRiLH on line 5 array(0) { }
Output for hhvm-3.10.0 - 3.12.0
Warning: Invalid operand type was used: Invalid type used as key in /in/fRiLH on line 5 array(0) { }
Output for 5.2.1
array(1) { ["c"]=> array(1) { ["b"]=> array(1) { ["a"]=> array(3) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> &string(1) "c" } } } }
Output for 5.0.0 - 5.2.0
array(1) { ["c"]=> array(1) { ["b"]=> array(1) { ["a"]=> array(3) { [0]=> &string(1) "a" [1]=> &string(1) "b" [2]=> &string(1) "c" } } } }
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '&', expecting T_VARIABLE or '$' in /in/fRiLH on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected '&', expecting T_VARIABLE or '$' in /in/fRiLH on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /in/fRiLH on line 4
Process exited with code 255.