3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = [1,2,3,4,5,6,7,8,9]; foreach ($a as $key => &$value) { if ($key === 4) { unset($a[$key + 1]); var_dump(key($a)); break; } } var_dump(key($a));
based on M3iTU
Output for 7.0.0 - 7.2.0
int(0) int(0)
Output for 5.4.2 - 5.6.28
int(6) int(6)
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/KjRVP on line 3
Process exited with code 255.