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($previousYear); switch(substr($row, 0, 1)){ 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 = 91
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 91
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 = 58, Position 2 = 62, Position 3 = 66, Position 4 = 70, Position 5 = 74, Position 6 = 78, Position 7 = 82, Position 8 = 86, Position 9 = 43
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 86
Branch analysis from position: 86
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 62
1 jumps found. (Code = 42) Position 1 = 86
Branch analysis from position: 86
Branch analysis from position: 66
1 jumps found. (Code = 42) Position 1 = 86
Branch analysis from position: 86
Branch analysis from position: 70
1 jumps found. (Code = 42) Position 1 = 86
Branch analysis from position: 86
Branch analysis from position: 74
1 jumps found. (Code = 42) Position 1 = 86
Branch analysis from position: 86
Branch analysis from position: 78
1 jumps found. (Code = 42) Position 1 = 86
Branch analysis from position: 86
Branch analysis from position: 82
1 jumps found. (Code = 42) Position 1 = 86
Branch analysis from position: 86
Branch analysis from position: 86
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 58
Branch analysis from position: 45
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 62
Branch analysis from position: 47
2 jumps found. (Code = 44) Position 1 = 49, Position 2 = 66
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 70
Branch analysis from position: 51
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 74
Branch analysis from position: 53
2 jumps found. (Code = 44) Position 1 = 55, Position 2 = 78
Branch analysis from position: 55
2 jumps found. (Code = 44) Position 1 = 57, Position 2 = 82
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 86
Branch analysis from position: 86
Branch analysis from position: 82
Branch analysis from position: 78
Branch analysis from position: 74
Branch analysis from position: 70
Branch analysis from position: 66
Branch analysis from position: 62
Branch analysis from position: 58
Branch analysis from position: 34
Branch analysis from position: 24
Branch analysis from position: 14
Branch analysis from position: 91
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 91
filename:       /in/dqvZL
function name:  (null)
number of ops:  96
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, ->91
          6    > > FE_FETCH_R                                               $11, !5, ->91
   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        SEND_VAR                                                 !3
         36        DO_ICALL                                                 
   23    37        INIT_FCALL                                               'substr'
         38        SEND_VAR                                                 !5
         39        SEND_VAL                                                 0
         40        SEND_VAL                                                 1
         41        DO_ICALL                                         $24     
         42      > SWITCH_STRING                                            $24, [ 'SS':->58, 'SU':->62, 'FW':->66, 'WI':->70, 'XM':->74, 'CO':->78, 'NW':->82, ], ->86
   24    43    >   CASE                                                     $24, 'SS'
         44      > JMPNZ                                                    ~25, ->58
   27    45    >   CASE                                                     $24, 'SU'
         46      > JMPNZ                                                    ~25, ->62
   30    47    >   CASE                                                     $24, 'FW'
         48      > JMPNZ                                                    ~25, ->66
   33    49    >   CASE                                                     $24, 'WI'
         50      > JMPNZ                                                    ~25, ->70
   36    51    >   CASE                                                     $24, 'XM'
         52      > JMPNZ                                                    ~25, ->74
   39    53    >   CASE                                                     $24, 'CO'
         54      > JMPNZ                                                    ~25, ->78
   42    55    >   CASE                                                     $24, 'NW'
         56      > JMPNZ                                                    ~25, ->82
         57    > > JMP                                                      ->86
   25    58    >   ADD                                              ~26     !4, 1
         59        ASSIGN_DIM                                               !1, ~26
         60        OP_DATA                                                  !5
   26    61      > JMP                                                      ->86
   28    62    >   ADD                                              ~28     !4, 2
         63        ASSIGN_DIM                                               !1, ~28
         64        OP_DATA                                                  !5
   29    65      > JMP                                                      ->86
   31    66    >   ADD                                              ~30     !4, 3
         67        ASSIGN_DIM                                               !1, ~30
         68        OP_DATA                                                  !5
   32    69      > JMP                                                      ->86
   34    70    >   ADD                                              ~32     !4, 4
         71        ASSIGN_DIM                                               !1, ~32
         72        OP_DATA                                                  !5
   35    73      > JMP                                                      ->86
   37    74    >   ADD                                              ~34     !4, 5
         75        ASSIGN_DIM                                               !1, ~34
         76        OP_DATA                                                  !5
   38    77      > JMP                                                      ->86
   40    78    >   ADD                                              ~36     !4, 6
         79        ASSIGN_DIM                                               !1, ~36
         80        OP_DATA                                                  !5
   41    81      > JMP                                                      ->86
   43    82    >   ADD                                              ~38     !4, 7
         83        ASSIGN_DIM                                               !1, ~38
         84        OP_DATA                                                  !5
   44    85      > JMP                                                      ->86
         86    >   FREE                                                     $24
   48    87        ASSIGN_DIM                                               !1
         88        OP_DATA                                                  !5
   49    89        PRE_INC                                                  !2
    9    90      > JMP                                                      ->6
         91    >   FE_FREE                                                  $11
   51    92        INIT_FCALL                                               'var_dump'
         93        SEND_VAR                                                 !1
         94        DO_ICALL                                                 
         95      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.3 ms | 1404 KiB | 17 Q