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; var_dump($strings); foreach($strings as $row){ if($counter == 0){ $previousYear = substr($row, -4); } var_dump('fist row'); var_dump($row); var_dump('counter'); var_dump($counter); var_dump('previous year'); var_dump($previousYear); var_dump('actual year'); var_dump(substr($row, -4)); if($previousYear != substr($row, -4)){ $currentIndex = $currentIndex + 10; } if($counter > 0){ $previousYear = substr($row, -4); } $part = substr($row, 0, 2); switch($part){ 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 = 9, Position 2 = 115
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 115
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 53
Branch analysis from position: 51
2 jumps found. (Code = 43) Position 1 = 55, Position 2 = 60
Branch analysis from position: 55
9 jumps found. (Code = 188) Position 1 = 82, Position 2 = 86, Position 3 = 90, Position 4 = 94, Position 5 = 98, Position 6 = 102, Position 7 = 106, Position 8 = 110, Position 9 = 67
Branch analysis from position: 82
1 jumps found. (Code = 42) Position 1 = 111
Branch analysis from position: 111
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 86
1 jumps found. (Code = 42) Position 1 = 111
Branch analysis from position: 111
Branch analysis from position: 90
1 jumps found. (Code = 42) Position 1 = 111
Branch analysis from position: 111
Branch analysis from position: 94
1 jumps found. (Code = 42) Position 1 = 111
Branch analysis from position: 111
Branch analysis from position: 98
1 jumps found. (Code = 42) Position 1 = 111
Branch analysis from position: 111
Branch analysis from position: 102
1 jumps found. (Code = 42) Position 1 = 111
Branch analysis from position: 111
Branch analysis from position: 106
1 jumps found. (Code = 42) Position 1 = 111
Branch analysis from position: 111
Branch analysis from position: 110
1 jumps found. (Code = 42) Position 1 = 111
Branch analysis from position: 111
Branch analysis from position: 67
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 82
Branch analysis from position: 69
2 jumps found. (Code = 44) Position 1 = 71, Position 2 = 86
Branch analysis from position: 71
2 jumps found. (Code = 44) Position 1 = 73, Position 2 = 90
Branch analysis from position: 73
2 jumps found. (Code = 44) Position 1 = 75, Position 2 = 94
Branch analysis from position: 75
2 jumps found. (Code = 44) Position 1 = 77, Position 2 = 98
Branch analysis from position: 77
2 jumps found. (Code = 44) Position 1 = 79, Position 2 = 102
Branch analysis from position: 79
2 jumps found. (Code = 44) Position 1 = 81, Position 2 = 106
Branch analysis from position: 81
1 jumps found. (Code = 42) Position 1 = 110
Branch analysis from position: 110
Branch analysis from position: 106
Branch analysis from position: 102
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: 60
Branch analysis from position: 53
Branch analysis from position: 17
Branch analysis from position: 115
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 115
filename:       /in/8JKjM
function name:  (null)
number of ops:  120
compiled vars:  !0 = $strings, !1 = $cleanUpResult, !2 = $counter, !3 = $previousYear, !4 = $currentIndex, !5 = $row, !6 = $part
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        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
   10     8      > FE_RESET_R                                       $13     !0, ->115
          9    > > FE_FETCH_R                                               $13, !5, ->115
   12    10    >   IS_EQUAL                                                 !2, 0
         11      > JMPZ                                                     ~14, ->17
   13    12    >   INIT_FCALL                                               'substr'
         13        SEND_VAR                                                 !5
         14        SEND_VAL                                                 -4
         15        DO_ICALL                                         $15     
         16        ASSIGN                                                   !3, $15
   16    17    >   INIT_FCALL                                               'var_dump'
         18        SEND_VAL                                                 'fist+row'
         19        DO_ICALL                                                 
   17    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !5
         22        DO_ICALL                                                 
   18    23        INIT_FCALL                                               'var_dump'
         24        SEND_VAL                                                 'counter'
         25        DO_ICALL                                                 
   19    26        INIT_FCALL                                               'var_dump'
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                                 
   20    29        INIT_FCALL                                               'var_dump'
         30        SEND_VAL                                                 'previous+year'
         31        DO_ICALL                                                 
   21    32        INIT_FCALL                                               'var_dump'
         33        SEND_VAR                                                 !3
         34        DO_ICALL                                                 
   22    35        INIT_FCALL                                               'var_dump'
         36        SEND_VAL                                                 'actual+year'
         37        DO_ICALL                                                 
   23    38        INIT_FCALL                                               'var_dump'
         39        INIT_FCALL                                               'substr'
         40        SEND_VAR                                                 !5
         41        SEND_VAL                                                 -4
         42        DO_ICALL                                         $24     
         43        SEND_VAR                                                 $24
         44        DO_ICALL                                                 
   25    45        INIT_FCALL                                               'substr'
         46        SEND_VAR                                                 !5
         47        SEND_VAL                                                 -4
         48        DO_ICALL                                         $26     
         49        IS_NOT_EQUAL                                             !3, $26
         50      > JMPZ                                                     ~27, ->53
   26    51    >   ADD                                              ~28     !4, 10
         52        ASSIGN                                                   !4, ~28
   29    53    >   IS_SMALLER                                               0, !2
         54      > JMPZ                                                     ~30, ->60
   30    55    >   INIT_FCALL                                               'substr'
         56        SEND_VAR                                                 !5
         57        SEND_VAL                                                 -4
         58        DO_ICALL                                         $31     
         59        ASSIGN                                                   !3, $31
   32    60    >   INIT_FCALL                                               'substr'
         61        SEND_VAR                                                 !5
         62        SEND_VAL                                                 0
         63        SEND_VAL                                                 2
         64        DO_ICALL                                         $33     
         65        ASSIGN                                                   !6, $33
   34    66      > SWITCH_STRING                                            !6, [ 'SS':->82, 'SU':->86, 'FW':->90, 'WI':->94, 'XM':->98, 'CO':->102, 'NW':->106, ], ->110
   35    67    >   IS_EQUAL                                                 !6, 'SS'
         68      > JMPNZ                                                    ~35, ->82
   38    69    >   IS_EQUAL                                                 !6, 'SU'
         70      > JMPNZ                                                    ~35, ->86
   41    71    >   IS_EQUAL                                                 !6, 'FW'
         72      > JMPNZ                                                    ~35, ->90
   44    73    >   IS_EQUAL                                                 !6, 'WI'
         74      > JMPNZ                                                    ~35, ->94
   47    75    >   IS_EQUAL                                                 !6, 'XM'
         76      > JMPNZ                                                    ~35, ->98
   50    77    >   IS_EQUAL                                                 !6, 'CO'
         78      > JMPNZ                                                    ~35, ->102
   53    79    >   IS_EQUAL                                                 !6, 'NW'
         80      > JMPNZ                                                    ~35, ->106
         81    > > JMP                                                      ->110
   36    82    >   ADD                                              ~36     !4, 1
         83        ASSIGN_DIM                                               !1, ~36
         84        OP_DATA                                                  !5
   37    85      > JMP                                                      ->111
   39    86    >   ADD                                              ~38     !4, 2
         87        ASSIGN_DIM                                               !1, ~38
         88        OP_DATA                                                  !5
   40    89      > JMP                                                      ->111
   42    90    >   ADD                                              ~40     !4, 3
         91        ASSIGN_DIM                                               !1, ~40
         92        OP_DATA                                                  !5
   43    93      > JMP                                                      ->111
   45    94    >   ADD                                              ~42     !4, 4
         95        ASSIGN_DIM                                               !1, ~42
         96        OP_DATA                                                  !5
   46    97      > JMP                                                      ->111
   48    98    >   ADD                                              ~44     !4, 5
         99        ASSIGN_DIM                                               !1, ~44
        100        OP_DATA                                                  !5
   49   101      > JMP                                                      ->111
   51   102    >   ADD                                              ~46     !4, 6
        103        ASSIGN_DIM                                               !1, ~46
        104        OP_DATA                                                  !5
   52   105      > JMP                                                      ->111
   54   106    >   ADD                                              ~48     !4, 7
        107        ASSIGN_DIM                                               !1, ~48
        108        OP_DATA                                                  !5
   55   109      > JMP                                                      ->111
   57   110    > > JMP                                                      ->111
   61   111    >   ASSIGN_DIM                                               !1
        112        OP_DATA                                                  !5
   62   113        PRE_INC                                                  !2
   10   114      > JMP                                                      ->9
        115    >   FE_FREE                                                  $13
   64   116        INIT_FCALL                                               'var_dump'
        117        SEND_VAR                                                 !1
        118        DO_ICALL                                                 
        119      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.29 ms | 1408 KiB | 17 Q