3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.94 ms | 1404 KiB | 17 Q