3v4l.org

run code in 300+ PHP versions simultaneously
<?php $snippet = '<?foreach($_GET[A]as$k=>$v){$b[$v][0]=$v;$b[$v][]=$k;}print_r([...$b]);'; echo 'Byte length: ' , strlen($snippet) , "\n"; $_GET[A] = [3, 2, 2, 3]; foreach($_GET[A]as$k=>$v){$b[$v][0]=$v;$b[$v][]=$k;}print_r([...$b]); // [[3, 0, 3], [2, 1, 2]] echo "\n---\n"; unset($b); $_GET[A] = [17]; foreach($_GET[A]as$k=>$v){$b[$v][0]=$v;$b[$v][]=$k;}print_r([...$b]); // [[17, 0]] echo "\n---\n"; unset($b); $_GET[A] = [1, 1]; foreach($_GET[A]as$k=>$v){$b[$v][0]=$v;$b[$v][]=$k;}print_r([...$b]); // [[1, 0, 1]] echo "\n---\n"; unset($b); $_GET[A] = [1, 1, 2]; foreach($_GET[A]as$k=>$v){$b[$v][0]=$v;$b[$v][]=$k;}print_r([...$b]); // [[1, 0, 1], [2, 2]] echo "\n---\n"; unset($b); $_GET[A] = [1, 2, 3, 4]; foreach($_GET[A]as$k=>$v){$b[$v][0]=$v;$b[$v][]=$k;}print_r([...$b]); // [[1, 0], [2, 1], [3, 2], [4, 3]] echo "\n---\n"; unset($b); $_GET[A] = [1, 1, 1, 1]; foreach($_GET[A]as$k=>$v){$b[$v][0]=$v;$b[$v][]=$k;}print_r([...$b]); // [[1, 0, 1, 2, 3]]
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 22
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 22
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 22
2 jumps found. (Code = 77) Position 1 = 38, Position 2 = 47
Branch analysis from position: 38
2 jumps found. (Code = 78) Position 1 = 39, Position 2 = 47
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 47
2 jumps found. (Code = 77) Position 1 = 63, Position 2 = 72
Branch analysis from position: 63
2 jumps found. (Code = 78) Position 1 = 64, Position 2 = 72
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 63
Branch analysis from position: 63
Branch analysis from position: 72
2 jumps found. (Code = 77) Position 1 = 88, Position 2 = 97
Branch analysis from position: 88
2 jumps found. (Code = 78) Position 1 = 89, Position 2 = 97
Branch analysis from position: 89
1 jumps found. (Code = 42) Position 1 = 88
Branch analysis from position: 88
Branch analysis from position: 97
2 jumps found. (Code = 77) Position 1 = 113, Position 2 = 122
Branch analysis from position: 113
2 jumps found. (Code = 78) Position 1 = 114, Position 2 = 122
Branch analysis from position: 114
1 jumps found. (Code = 42) Position 1 = 113
Branch analysis from position: 113
Branch analysis from position: 122
2 jumps found. (Code = 77) Position 1 = 138, Position 2 = 147
Branch analysis from position: 138
2 jumps found. (Code = 78) Position 1 = 139, Position 2 = 147
Branch analysis from position: 139
1 jumps found. (Code = 42) Position 1 = 138
Branch analysis from position: 138
Branch analysis from position: 147
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 147
Branch analysis from position: 122
Branch analysis from position: 97
Branch analysis from position: 72
Branch analysis from position: 47
Branch analysis from position: 22
filename:       /in/UHQWO
function name:  (null)
number of ops:  154
compiled vars:  !0 = $snippet, !1 = $v, !2 = $k, !3 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3C%3Fforeach%28%24_GET%5BA%5Das%24k%3D%3E%24v%29%7B%24b%5B%24v%5D%5B0%5D%3D%24v%3B%24b%5B%24v%5D%5B%5D%3D%24k%3B%7Dprint_r%28%5B...%24b%5D%29%3B'
    3     1        ECHO                                                     'Byte+length%3A+'
          2        STRLEN                                           ~5      !0
          3        ECHO                                                     ~5
          4        ECHO                                                     '%0A'
    5     5        FETCH_CONSTANT                                   ~7      'A'
          6        FETCH_W                      global              $6      '_GET'
          7        ASSIGN_DIM                                               $6, ~7
          8        OP_DATA                                                  <array>
    6     9        FETCH_CONSTANT                                   ~10     'A'
         10        FETCH_R                      global              ~9      '_GET'
         11        FETCH_DIM_R                                      ~11     ~9, ~10
         12      > FE_RESET_R                                       $12     ~11, ->22
         13    > > FE_FETCH_R                                       ~13     $12, !1, ->22
         14    >   ASSIGN                                                   !2, ~13
         15        FETCH_DIM_W                                      $15     !3, !1
         16        ASSIGN_DIM                                               $15, 0
         17        OP_DATA                                                  !1
         18        FETCH_DIM_W                                      $17     !3, !1
         19        ASSIGN_DIM                                               $17
         20        OP_DATA                                                  !2
         21      > JMP                                                      ->13
         22    >   FE_FREE                                                  $12
         23        INIT_FCALL                                               'print_r'
         24        INIT_ARRAY                                       ~19     
         25        ADD_ARRAY_UNPACK                                 ~19     !3
         26        SEND_VAL                                                 ~19
         27        DO_ICALL                                                 
    9    28        ECHO                                                     '%0A---%0A'
         29        UNSET_CV                                                 !3
   10    30        FETCH_CONSTANT                                   ~22     'A'
         31        FETCH_W                      global              $21     '_GET'
         32        ASSIGN_DIM                                               $21, ~22
         33        OP_DATA                                                  <array>
   11    34        FETCH_CONSTANT                                   ~25     'A'
         35        FETCH_R                      global              ~24     '_GET'
         36        FETCH_DIM_R                                      ~26     ~24, ~25
         37      > FE_RESET_R                                       $27     ~26, ->47
         38    > > FE_FETCH_R                                       ~28     $27, !1, ->47
         39    >   ASSIGN                                                   !2, ~28
         40        FETCH_DIM_W                                      $30     !3, !1
         41        ASSIGN_DIM                                               $30, 0
         42        OP_DATA                                                  !1
         43        FETCH_DIM_W                                      $32     !3, !1
         44        ASSIGN_DIM                                               $32
         45        OP_DATA                                                  !2
         46      > JMP                                                      ->38
         47    >   FE_FREE                                                  $27
         48        INIT_FCALL                                               'print_r'
         49        INIT_ARRAY                                       ~34     
         50        ADD_ARRAY_UNPACK                                 ~34     !3
         51        SEND_VAL                                                 ~34
         52        DO_ICALL                                                 
   14    53        ECHO                                                     '%0A---%0A'
         54        UNSET_CV                                                 !3
   15    55        FETCH_CONSTANT                                   ~37     'A'
         56        FETCH_W                      global              $36     '_GET'
         57        ASSIGN_DIM                                               $36, ~37
         58        OP_DATA                                                  <array>
   16    59        FETCH_CONSTANT                                   ~40     'A'
         60        FETCH_R                      global              ~39     '_GET'
         61        FETCH_DIM_R                                      ~41     ~39, ~40
         62      > FE_RESET_R                                       $42     ~41, ->72
         63    > > FE_FETCH_R                                       ~43     $42, !1, ->72
         64    >   ASSIGN                                                   !2, ~43
         65        FETCH_DIM_W                                      $45     !3, !1
         66        ASSIGN_DIM                                               $45, 0
         67        OP_DATA                                                  !1
         68        FETCH_DIM_W                                      $47     !3, !1
         69        ASSIGN_DIM                                               $47
         70        OP_DATA                                                  !2
         71      > JMP                                                      ->63
         72    >   FE_FREE                                                  $42
         73        INIT_FCALL                                               'print_r'
         74        INIT_ARRAY                                       ~49     
         75        ADD_ARRAY_UNPACK                                 ~49     !3
         76        SEND_VAL                                                 ~49
         77        DO_ICALL                                                 
   19    78        ECHO                                                     '%0A---%0A'
         79        UNSET_CV                                                 !3
   20    80        FETCH_CONSTANT                                   ~52     'A'
         81        FETCH_W                      global              $51     '_GET'
         82        ASSIGN_DIM                                               $51, ~52
         83        OP_DATA                                                  <array>
   21    84        FETCH_CONSTANT                                   ~55     'A'
         85        FETCH_R                      global              ~54     '_GET'
         86        FETCH_DIM_R                                      ~56     ~54, ~55
         87      > FE_RESET_R                                       $57     ~56, ->97
         88    > > FE_FETCH_R                                       ~58     $57, !1, ->97
         89    >   ASSIGN                                                   !2, ~58
         90        FETCH_DIM_W                                      $60     !3, !1
         91        ASSIGN_DIM                                               $60, 0
         92        OP_DATA                                                  !1
         93        FETCH_DIM_W                                      $62     !3, !1
         94        ASSIGN_DIM                                               $62
         95        OP_DATA                                                  !2
         96      > JMP                                                      ->88
         97    >   FE_FREE                                                  $57
         98        INIT_FCALL                                               'print_r'
         99        INIT_ARRAY                                       ~64     
        100        ADD_ARRAY_UNPACK                                 ~64     !3
        101        SEND_VAL                                                 ~64
        102        DO_ICALL                                                 
   24   103        ECHO                                                     '%0A---%0A'
        104        UNSET_CV                                                 !3
   25   105        FETCH_CONSTANT                                   ~67     'A'
        106        FETCH_W                      global              $66     '_GET'
        107        ASSIGN_DIM                                               $66, ~67
        108        OP_DATA                                                  <array>
   26   109        FETCH_CONSTANT                                   ~70     'A'
        110        FETCH_R                      global              ~69     '_GET'
        111        FETCH_DIM_R                                      ~71     ~69, ~70
        112      > FE_RESET_R                                       $72     ~71, ->122
        113    > > FE_FETCH_R                                       ~73     $72, !1, ->122
        114    >   ASSIGN                                                   !2, ~73
        115        FETCH_DIM_W                                      $75     !3, !1
        116        ASSIGN_DIM                                               $75, 0
        117        OP_DATA                                                  !1
        118        FETCH_DIM_W                                      $77     !3, !1
        119        ASSIGN_DIM                                               $77
        120        OP_DATA                                                  !2
        121      > JMP                                                      ->113
        122    >   FE_FREE                                                  $72
        123        INIT_FCALL                                               'print_r'
        124        INIT_ARRAY                                       ~79     
        125        ADD_ARRAY_UNPACK                                 ~79     !3
        126        SEND_VAL                                                 ~79
        127        DO_ICALL                                                 
   29   128        ECHO                                                     '%0A---%0A'
        129        UNSET_CV                                                 !3
   30   130        FETCH_CONSTANT                                   ~82     'A'
        131        FETCH_W                      global              $81     '_GET'
        132        ASSIGN_DIM                                               $81, ~82
        133        OP_DATA                                                  <array>
   31   134        FETCH_CONSTANT                                   ~85     'A'
        135        FETCH_R                      global              ~84     '_GET'
        136        FETCH_DIM_R                                      ~86     ~84, ~85
        137      > FE_RESET_R                                       $87     ~86, ->147
        138    > > FE_FETCH_R                                       ~88     $87, !1, ->147
        139    >   ASSIGN                                                   !2, ~88
        140        FETCH_DIM_W                                      $90     !3, !1
        141        ASSIGN_DIM                                               $90, 0
        142        OP_DATA                                                  !1
        143        FETCH_DIM_W                                      $92     !3, !1
        144        ASSIGN_DIM                                               $92
        145        OP_DATA                                                  !2
        146      > JMP                                                      ->138
        147    >   FE_FREE                                                  $87
        148        INIT_FCALL                                               'print_r'
        149        INIT_ARRAY                                       ~94     
        150        ADD_ARRAY_UNPACK                                 ~94     !3
        151        SEND_VAL                                                 ~94
        152        DO_ICALL                                                 
   32   153      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.9 ms | 1408 KiB | 15 Q