3v4l.org

run code in 300+ PHP versions simultaneously
<?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++; } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 18
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/j0Q4b
function name:  (null)
number of ops:  20
compiled vars:  !0 = $dow, !1 = $pick_a_day, !2 = $an_element, !3 = $inc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, 2
    7     2        PRE_DEC                                                  !1
    9     3      > FE_RESET_R                                       $7      !0, ->18
          4    > > FE_FETCH_R                                       ~8      $7, !2, ->18
          5    >   ASSIGN                                                   !3, ~8
   12     6        COUNT                                            ~10     !0
          7        ADD                                              ~11     !1, ~10
          8        COUNT                                            ~12     !0
          9        MOD                                              ~13     ~11, ~12
         10        FETCH_DIM_R                                      ~14     !0, ~13
         11        CONCAT                                           ~15     ~14, '+-+loop+number%3A'
         12        ADD                                              ~16     !3, 1
         13        CONCAT                                           ~17     ~15, ~16
         14        CONCAT                                           ~18     ~17, '%0A'
         15        ECHO                                                     ~18
   13    16        PRE_INC                                                  !1
    9    17      > JMP                                                      ->4
         18    >   FE_FREE                                                  $7
   16    19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.98 ms | 1394 KiB | 13 Q