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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.13 ms | 1408 KiB | 17 Q