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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.73 ms | 1396 KiB | 17 Q