3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = array('SS2014','SU2014','FW2014','SS2013','FW2013','NW2012'); $cleanUpResult = array(); $counter = 0; $previousYear = ''; $currentIndex = 10; foreach($strings as $row){ if($counter == 0){ $previousYear = substr($row, -4); } if($previousYear !== substr($row, -4)){ $currentIndex += 10; } if($counter > 0){ $previousYear = substr($row, -4); } var_dump(substr($row, -4)); switch(substr($row, 0, 2)){ case 'SS': $cleanUpResult[$currentIndex + 1] = $row; break; case 'SU': $cleanUpResult[$currentIndex + 2] = $row; break; case 'FW': $cleanUpResult[$currentIndex + 3] = $row; break; case 'WI': $cleanUpResult[$currentIndex + 4] = $row; break; case 'XM': $cleanUpResult[$currentIndex + 5] = $row; break; case 'CO': $cleanUpResult[$currentIndex + 6] = $row; break; case 'NW': $cleanUpResult[$currentIndex + 7] = $row; break; } $cleanUpResult[] = $row; $counter++; } var_dump($cleanUpResult);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 89
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 89
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 21
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 28
Branch analysis from position: 23
9 jumps found. (Code = 188) Position 1 = 56, Position 2 = 60, Position 3 = 64, Position 4 = 68, Position 5 = 72, Position 6 = 76, Position 7 = 80, Position 8 = 84, Position 9 = 41
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 84
Branch analysis from position: 84
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 60
1 jumps found. (Code = 42) Position 1 = 84
Branch analysis from position: 84
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 84
Branch analysis from position: 84
Branch analysis from position: 68
1 jumps found. (Code = 42) Position 1 = 84
Branch analysis from position: 84
Branch analysis from position: 72
1 jumps found. (Code = 42) Position 1 = 84
Branch analysis from position: 84
Branch analysis from position: 76
1 jumps found. (Code = 42) Position 1 = 84
Branch analysis from position: 84
Branch analysis from position: 80
1 jumps found. (Code = 42) Position 1 = 84
Branch analysis from position: 84
Branch analysis from position: 84
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 56
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 60
Branch analysis from position: 45
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 64
Branch analysis from position: 47
2 jumps found. (Code = 44) Position 1 = 49, Position 2 = 68
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 72
Branch analysis from position: 51
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 76
Branch analysis from position: 53
2 jumps found. (Code = 44) Position 1 = 55, Position 2 = 80
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 84
Branch analysis from position: 84
Branch analysis from position: 80
Branch analysis from position: 76
Branch analysis from position: 72
Branch analysis from position: 68
Branch analysis from position: 64
Branch analysis from position: 60
Branch analysis from position: 56
Branch analysis from position: 28
Branch analysis from position: 21
Branch analysis from position: 14
Branch analysis from position: 89
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 89
filename:       /in/quRCv
function name:  (null)
number of ops:  94
compiled vars:  !0 = $strings, !1 = $cleanUpResult, !2 = $counter, !3 = $previousYear, !4 = $currentIndex, !5 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, 0
    7     3        ASSIGN                                                   !3, ''
    8     4        ASSIGN                                                   !4, 10
    9     5      > FE_RESET_R                                       $11     !0, ->89
          6    > > FE_FETCH_R                                               $11, !5, ->89
   10     7    >   IS_EQUAL                                                 !2, 0
          8      > JMPZ                                                     ~12, ->14
   11     9    >   INIT_FCALL                                               'substr'
         10        SEND_VAR                                                 !5
         11        SEND_VAL                                                 -4
         12        DO_ICALL                                         $13     
         13        ASSIGN                                                   !3, $13
   14    14    >   INIT_FCALL                                               'substr'
         15        SEND_VAR                                                 !5
         16        SEND_VAL                                                 -4
         17        DO_ICALL                                         $15     
         18        IS_NOT_IDENTICAL                                         !3, $15
         19      > JMPZ                                                     ~16, ->21
   15    20    >   ASSIGN_OP                                     1          !4, 10
   18    21    >   IS_SMALLER                                               0, !2
         22      > JMPZ                                                     ~18, ->28
   19    23    >   INIT_FCALL                                               'substr'
         24        SEND_VAR                                                 !5
         25        SEND_VAL                                                 -4
         26        DO_ICALL                                         $19     
         27        ASSIGN                                                   !3, $19
   22    28    >   INIT_FCALL                                               'var_dump'
         29        INIT_FCALL                                               'substr'
         30        SEND_VAR                                                 !5
         31        SEND_VAL                                                 -4
         32        DO_ICALL                                         $21     
         33        SEND_VAR                                                 $21
         34        DO_ICALL                                                 
   24    35        INIT_FCALL                                               'substr'
         36        SEND_VAR                                                 !5
         37        SEND_VAL                                                 0
         38        SEND_VAL                                                 2
         39        DO_ICALL                                         $23     
         40      > SWITCH_STRING                                            $23, [ 'SS':->56, 'SU':->60, 'FW':->64, 'WI':->68, 'XM':->72, 'CO':->76, 'NW':->80, ], ->84
   25    41    >   CASE                                                     $23, 'SS'
         42      > JMPNZ                                                    ~24, ->56
   28    43    >   CASE                                                     $23, 'SU'
         44      > JMPNZ                                                    ~24, ->60
   31    45    >   CASE                                                     $23, 'FW'
         46      > JMPNZ                                                    ~24, ->64
   34    47    >   CASE                                                     $23, 'WI'
         48      > JMPNZ                                                    ~24, ->68
   37    49    >   CASE                                                     $23, 'XM'
         50      > JMPNZ                                                    ~24, ->72
   40    51    >   CASE                                                     $23, 'CO'
         52      > JMPNZ                                                    ~24, ->76
   43    53    >   CASE                                                     $23, 'NW'
         54      > JMPNZ                                                    ~24, ->80
         55    > > JMP                                                      ->84
   26    56    >   ADD                                              ~25     !4, 1
         57        ASSIGN_DIM                                               !1, ~25
         58        OP_DATA                                                  !5
   27    59      > JMP                                                      ->84
   29    60    >   ADD                                              ~27     !4, 2
         61        ASSIGN_DIM                                               !1, ~27
         62        OP_DATA                                                  !5
   30    63      > JMP                                                      ->84
   32    64    >   ADD                                              ~29     !4, 3
         65        ASSIGN_DIM                                               !1, ~29
         66        OP_DATA                                                  !5
   33    67      > JMP                                                      ->84
   35    68    >   ADD                                              ~31     !4, 4
         69        ASSIGN_DIM                                               !1, ~31
         70        OP_DATA                                                  !5
   36    71      > JMP                                                      ->84
   38    72    >   ADD                                              ~33     !4, 5
         73        ASSIGN_DIM                                               !1, ~33
         74        OP_DATA                                                  !5
   39    75      > JMP                                                      ->84
   41    76    >   ADD                                              ~35     !4, 6
         77        ASSIGN_DIM                                               !1, ~35
         78        OP_DATA                                                  !5
   42    79      > JMP                                                      ->84
   44    80    >   ADD                                              ~37     !4, 7
         81        ASSIGN_DIM                                               !1, ~37
         82        OP_DATA                                                  !5
   45    83      > JMP                                                      ->84
         84    >   FREE                                                     $23
   49    85        ASSIGN_DIM                                               !1
         86        OP_DATA                                                  !5
   50    87        PRE_INC                                                  !2
    9    88      > JMP                                                      ->6
         89    >   FE_FREE                                                  $11
   52    90        INIT_FCALL                                               'var_dump'
         91        SEND_VAR                                                 !1
         92        DO_ICALL                                                 
         93      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.42 ms | 1404 KiB | 17 Q