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 $pic_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 5.0.4 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Notice: Undefined variable: pic_a_day in /in/thvnT on line 7 wed - loop number:1 thu - loop number:2 fri - loop number:3 sat - loop number:4 sun - loop number:5 mon - loop number:6 tue - loop number:7
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: pic_a_day in /in/thvnT on line 7 wed - loop number:1 thu - loop number:2 fri - loop number:3 sat - loop number:4 sun - loop number:5 mon - loop number:6 tue - loop number:7