3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = array("a", "b", "c"); next($a); var_dump(current($a)); $b = $a; var_dump(current($b)); function by_copy($c) { var_dump(current($c)); } by_copy($a); function by_ref(&$d) { var_dump(current($d)); } by_ref($a);
based on dsCal
Output for 5.2.4 - 7.2.0
string(1) "b" string(1) "b" string(1) "b" string(1) "b"
Output for 4.3.0 - 4.4.0, 4.4.2 - 5.2.3
string(1) "b" string(1) "a" string(1) "a" string(1) "b"
Output for 4.4.1
string(1) "b" string(1) "b" string(1) "b" string(1) "a"