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': var_dump($part, $row); $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 = 119
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 119
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 = 98, Position 5 = 102, Position 6 = 106, Position 7 = 110, Position 8 = 114, Position 9 = 67
Branch analysis from position: 82
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
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 = 115
Branch analysis from position: 115
Branch analysis from position: 90
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
Branch analysis from position: 98
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
Branch analysis from position: 102
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
Branch analysis from position: 106
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
Branch analysis from position: 110
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
Branch analysis from position: 114
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
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 = 98
Branch analysis from position: 75
2 jumps found. (Code = 44) Position 1 = 77, Position 2 = 102
Branch analysis from position: 77
2 jumps found. (Code = 44) Position 1 = 79, Position 2 = 106
Branch analysis from position: 79
2 jumps found. (Code = 44) Position 1 = 81, Position 2 = 110
Branch analysis from position: 81
1 jumps found. (Code = 42) Position 1 = 114
Branch analysis from position: 114
Branch analysis from position: 110
Branch analysis from position: 106
Branch analysis from position: 102
Branch analysis from position: 98
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: 119
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 119
filename:       /in/6j2lN
function name:  (null)
number of ops:  124
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, ->119
          9    > > FE_FETCH_R                                               $13, !5, ->119
   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_IDENTICAL                                         !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':->98, 'XM':->102, 'CO':->106, 'NW':->110, ], ->114
   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
   45    73    >   IS_EQUAL                                                 !6, 'WI'
         74      > JMPNZ                                                    ~35, ->98
   48    75    >   IS_EQUAL                                                 !6, 'XM'
         76      > JMPNZ                                                    ~35, ->102
   51    77    >   IS_EQUAL                                                 !6, 'CO'
         78      > JMPNZ                                                    ~35, ->106
   54    79    >   IS_EQUAL                                                 !6, 'NW'
         80      > JMPNZ                                                    ~35, ->110
         81    > > JMP                                                      ->114
   36    82    >   ADD                                              ~36     !4, 1
         83        ASSIGN_DIM                                               !1, ~36
         84        OP_DATA                                                  !5
   37    85      > JMP                                                      ->115
   39    86    >   ADD                                              ~38     !4, 2
         87        ASSIGN_DIM                                               !1, ~38
         88        OP_DATA                                                  !5
   40    89      > JMP                                                      ->115
   42    90    >   INIT_FCALL                                               'var_dump'
         91        SEND_VAR                                                 !6
         92        SEND_VAR                                                 !5
         93        DO_ICALL                                                 
   43    94        ADD                                              ~41     !4, 3
         95        ASSIGN_DIM                                               !1, ~41
         96        OP_DATA                                                  !5
   44    97      > JMP                                                      ->115
   46    98    >   ADD                                              ~43     !4, 4
         99        ASSIGN_DIM                                               !1, ~43
        100        OP_DATA                                                  !5
   47   101      > JMP                                                      ->115
   49   102    >   ADD                                              ~45     !4, 5
        103        ASSIGN_DIM                                               !1, ~45
        104        OP_DATA                                                  !5
   50   105      > JMP                                                      ->115
   52   106    >   ADD                                              ~47     !4, 6
        107        ASSIGN_DIM                                               !1, ~47
        108        OP_DATA                                                  !5
   53   109      > JMP                                                      ->115
   55   110    >   ADD                                              ~49     !4, 7
        111        ASSIGN_DIM                                               !1, ~49
        112        OP_DATA                                                  !5
   56   113      > JMP                                                      ->115
   58   114    > > JMP                                                      ->115
   62   115    >   ASSIGN_DIM                                               !1
        116        OP_DATA                                                  !5
   63   117        PRE_INC                                                  !2
   10   118      > JMP                                                      ->9
        119    >   FE_FREE                                                  $13
   65   120        INIT_FCALL                                               'var_dump'
        121        SEND_VAR                                                 !1
        122        DO_ICALL                                                 
        123      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.38 ms | 1408 KiB | 17 Q