3v4l.org

run code in 200+ 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 - 7.1.10
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 4.3.11