3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.15 ms | 1404 KiB | 17 Q