3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $list = array("A","B","C","D"); $list = &$lost; foreach ( $list as $var ) { print(current($list)); } echo "\n"; foreach ( $list as $var ) { print(item($list)); } function item($list) { return current($list); } echo "\n"; item2($list); function item2($list) { foreach ( $list as $var ) { print(current($list)); } } ?>
Output for 4.3.0 - 4.3.10, 4.4.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: Invalid argument supplied for foreach() in /in/AlEfM on line 7 Warning: Invalid argument supplied for foreach() in /in/AlEfM on line 13 Warning: Invalid argument supplied for foreach() in /in/AlEfM on line 25
Output for hhvm-3.10.0 - 3.12.0
Warning: Invalid argument supplied for foreach() in /in/AlEfM on line 9 Warning: Invalid argument supplied for foreach() in /in/AlEfM on line 15 Warning: Invalid argument supplied for foreach() in /in/AlEfM on line 27
Output for 4.3.11