3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arr = array(1,2,3,4,5,6,7,8,9); foreach($arr as $key=>$value) { unset($arr[$key + 1]); echo $value . "\n"; echo "key=" . $key . ", value=" . $value . ", key+1=" . ($key+1) . ", arr[key+1]=" . $arr[$key + 1] . "\n\n"; }
Output for 5.3.0 - 7.1.0
1 Notice: Undefined offset: 1 in /in/5auso on line 9 key=0, value=1, key+1=1, arr[key+1]= 2 Notice: Undefined offset: 2 in /in/5auso on line 9 key=1, value=2, key+1=2, arr[key+1]= 3 Notice: Undefined offset: 3 in /in/5auso on line 9 key=2, value=3, key+1=3, arr[key+1]= 4 Notice: Undefined offset: 4 in /in/5auso on line 9 key=3, value=4, key+1=4, arr[key+1]= 5 Notice: Undefined offset: 5 in /in/5auso on line 9 key=4, value=5, key+1=5, arr[key+1]= 6 Notice: Undefined offset: 6 in /in/5auso on line 9 key=5, value=6, key+1=6, arr[key+1]= 7 Notice: Undefined offset: 7 in /in/5auso on line 9 key=6, value=7, key+1=7, arr[key+1]= 8 Notice: Undefined offset: 8 in /in/5auso on line 9 key=7, value=8, key+1=8, arr[key+1]= 9 Notice: Undefined offset: 9 in /in/5auso on line 9 key=8, value=9, key+1=9, arr[key+1]=
Output for 4.3.0 - 5.2.17
1 Notice: Undefined offset: 1 in /in/5auso on line 9 key=0, value=1, key+1=1, arr[key+1]= 2 Notice: Undefined offset: 2 in /in/5auso on line 9 key=1, value=2, key+1=2, arr[key+1]= 3 Notice: Undefined offset: 3 in /in/5auso on line 9 key=2, value=3, key+1=3, arr[key+1]= 4 Notice: Undefined offset: 4 in /in/5auso on line 9 key=3, value=4, key+1=4, arr[key+1]= 5 Notice: Undefined offset: 5 in /in/5auso on line 9 key=4, value=5, key+1=5, arr[key+1]= 6 Notice: Undefined offset: 6 in /in/5auso on line 9 key=5, value=6, key+1=6, arr[key+1]= 7 Notice: Undefined offset: 7 in /in/5auso on line 9 key=6, value=7, key+1=7, arr[key+1]= 8 Notice: Undefined offset: 8 in /in/5auso on line 9 key=7, value=8, key+1=8, arr[key+1]= 9 Notice: Undefined offset: 9 in /in/5auso on line 9 key=8, value=9, key+1=9, arr[key+1]=