3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dayOfWeek = 0; $array = array( 2,3,4,5,0 ); $size = count($array); for ($x = 0; $x < $size; $x ++) { if ($array[$x] == $dayOfWeek && $x + 1 == $size) { $nextDay = $array[0]; $totalDays = $dayOfWeek + $nextDay; echo $totalDays % 7; } elseif ($array[$x] == $dayOfWeek) { echo $array[$x +1] - $dayOfWeek; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 6
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 6
Branch analysis from position: 30
Branch analysis from position: 6
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 27
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 6
Branch analysis from position: 30
Branch analysis from position: 6
Branch analysis from position: 27
Branch analysis from position: 12
filename:       /in/iWbLn
function name:  (null)
number of ops:  31
compiled vars:  !0 = $dayOfWeek, !1 = $array, !2 = $size, !3 = $x, !4 = $nextDay, !5 = $totalDays
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 0
    3     1        ASSIGN                                                   !1, <array>
    4     2        COUNT                                            ~8      !1
          3        ASSIGN                                                   !2, ~8
    6     4        ASSIGN                                                   !3, 0
          5      > JMP                                                      ->28
    7     6    >   FETCH_DIM_R                                      ~11     !1, !3
          7        IS_EQUAL                                         ~12     !0, ~11
          8      > JMPZ_EX                                          ~12     ~12, ->12
          9    >   ADD                                              ~13     !3, 1
         10        IS_EQUAL                                         ~14     !2, ~13
         11        BOOL                                             ~12     ~14
         12    > > JMPZ                                                     ~12, ->20
    8    13    >   FETCH_DIM_R                                      ~15     !1, 0
         14        ASSIGN                                                   !4, ~15
    9    15        ADD                                              ~17     !0, !4
         16        ASSIGN                                                   !5, ~17
   10    17        MOD                                              ~19     !5, 7
         18        ECHO                                                     ~19
         19      > JMP                                                      ->27
   11    20    >   FETCH_DIM_R                                      ~20     !1, !3
         21        IS_EQUAL                                                 !0, ~20
         22      > JMPZ                                                     ~21, ->27
   12    23    >   ADD                                              ~22     !3, 1
         24        FETCH_DIM_R                                      ~23     !1, ~22
         25        SUB                                              ~24     ~23, !0
         26        ECHO                                                     ~24
    6    27    >   PRE_INC                                                  !3
         28    >   IS_SMALLER                                               !3, !2
         29      > JMPNZ                                                    ~26, ->6
   14    30    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.22 ms | 1395 KiB | 13 Q