3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = [1, 2, 3, 4, 5]; foreach ($array as $value) { echo $value . ' - ' . current($array) . "\n"; next($array); }
based on alaRP
Output for 7.0.0 - 7.2.0
1 - 1 2 - 2 3 - 3 4 - 4 5 - 5
Output for 5.4.10 - 5.6.28
1 - 2 2 - 3 3 - 4 4 - 5 5 -
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/Krc8b on line 3
Process exited with code 255.