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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.9 ms | 1396 KiB | 17 Q