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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.43 ms | 1396 KiB | 17 Q