3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $dow = array("mon","tue","wed","thu","fri","sat","sun"); $pick_a_day = 2; // user input; NON zero based. monday = 1 $pick_a_day--; // make it zero based to use in code foreach($dow as $inc => $an_element ) { echo $dow[($pick_a_day+(count($dow))) % (count($dow))]." - loop number:".($inc+1)."\n"; $pick_a_day++; } ?>
Output for 4.3.0 - 7.1.0
tue - loop number:1 wed - loop number:2 thu - loop number:3 fri - loop number:4 sat - loop number:5 sun - loop number:6 mon - loop number:7