3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = array('a', 'b', 'c', 'd', null); for($i = 0; $i < count($a); $i += 2) { echo $i . " "; if (array_key_exists($i + 1, $a)) { echo $a[$i + 1] . " "; } echo ($i + 1) . PHP_EOL; } $n = explode('|', $a[5]); var_dump($n); var_dump(array(''));
based on 284kS
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.3.0rc3
0 b 1 2 d 3 4 5 Notice: Undefined offset: 5 in /in/GKQHL on line 12 array(1) { [0]=> string(0) "" } array(1) { [0]=> string(0) "" }
Output for hhvm-3.15.4
0 b 1 2 d 3 4 5 Notice: Undefined index: 5 in /in/GKQHL on line 12 Warning: explode() expects parameter 2 to be string, null given in /in/GKQHL on line 12 NULL array(1) { [0]=> string(0) "" }