3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $loops_count = 0; $arr = array('apple1', 'orange1', 'banana1', 'potato1', 'cocos1', 'lime1'); do { if(next($arr) === false){ reset($arr); $loops_count++; } var_dump(current($arr)); } while ($loops_count < 3);
Output for 4.3.0 - 7.1.0
string(7) "orange1" string(7) "banana1" string(7) "potato1" string(6) "cocos1" string(5) "lime1" string(6) "apple1" string(7) "orange1" string(7) "banana1" string(7) "potato1" string(6) "cocos1" string(5) "lime1" string(6) "apple1" string(7) "orange1" string(7) "banana1" string(7) "potato1" string(6) "cocos1" string(5) "lime1" string(6) "apple1"