3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php echo "mama"; $array = array ( 1 => "a", 2 => "b", 3=> "c", ); $andra = array( 1=>12, 3=>14); $andra[]=56; $nr=count($andra); for($i=0;$i<$nr;$i++) echo "bad " . $andra[$i] . "\n"; echo " {$andra[$i]}\n"; var_dump($array); ?>
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
mama Notice: Undefined offset: 0 in /in/HALRC on line 17 bad bad 12 Notice: Undefined offset: 2 in /in/HALRC on line 17 bad 14 array(3) { [1]=> string(1) "a" [2]=> string(1) "b" [3]=> string(1) "c" }
Output for hhvm-3.10.0 - 3.12.0
mama Notice: Undefined index: 0 in /in/HALRC on line 17 bad bad 12 Notice: Undefined index: 2 in /in/HALRC on line 17 bad 14 array(3) { [1]=> string(1) "a" [2]=> string(1) "b" [3]=> string(1) "c" }
Output for 4.3.0 - 5.2.17
mama Notice: Undefined offset: 0 in /in/HALRC on line 17 bad bad 12 Notice: Undefined offset: 2 in /in/HALRC on line 17 bad 14 array(3) { [1]=> string(1) "a" [2]=> string(1) "b" [3]=> string(1) "c" }