3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array('a' => '…', 'b' => '…', 'c' => '…', 'd' => '…', 'e' => '…', 'f' => '…'); foreach ($array as $key => $val){ echo "current key: $key, next key: ".key($array)."<br>"; }
Output for 4.3.0 - 4.4.0, 4.4.2 - 5.2.3, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
current key: a, next key: a<br>current key: b, next key: a<br>current key: c, next key: a<br>current key: d, next key: a<br>current key: e, next key: a<br>current key: f, next key: a<br>
Output for 5.2.4 - 5.6.28
current key: a, next key: b<br>current key: b, next key: b<br>current key: c, next key: b<br>current key: d, next key: b<br>current key: e, next key: b<br>current key: f, next key: b<br>
Output for 4.4.1
current key: a, next key: b<br>current key: b, next key: c<br>current key: c, next key: d<br>current key: d, next key: e<br>current key: e, next key: f<br>current key: f, next key: <br>