3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public $keyProp, $valProp; public static $staticValProp; } class Test2 { public static $staticKeyProp; } $array = [1, 2, 3]; $a = []; foreach ($array as $a[0] => $a[1]) { echo "$a[0] => $a[1],"; } echo "\n"; $i = 0; $a = []; foreach ($array as $a[] => $a[]) { echo $a[$i+1], " => ", $a[$i], ","; $i += 2; } echo "\n"; $obj = new Test; foreach ($array as $obj->keyProp => $obj->valProp) { echo "$obj->keyProp => $obj->valProp,"; } echo "\n"; foreach ($array as Test2::$staticKeyProp => Test::$staticValProp) { echo Test2::$staticKeyProp, " => ", Test::$staticValProp, ","; } echo "\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 16
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 16
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 16
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 35
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 35
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 35
2 jumps found. (Code = 77) Position 1 = 41, Position 2 = 54
Branch analysis from position: 41
2 jumps found. (Code = 78) Position 1 = 42, Position 2 = 54
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 54
2 jumps found. (Code = 77) Position 1 = 57, Position 2 = 69
Branch analysis from position: 57
2 jumps found. (Code = 78) Position 1 = 58, Position 2 = 69
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
Branch analysis from position: 69
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 69
Branch analysis from position: 54
Branch analysis from position: 35
Branch analysis from position: 16
filename:       /in/IGJXV
function name:  (null)
number of ops:  72
compiled vars:  !0 = $array, !1 = $a, !2 = $i, !3 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   13     1        ASSIGN                                                   !1, <array>
   14     2      > FE_RESET_R                                       $6      !0, ->16
          3    > > FE_FETCH_R                                       ~9      $6, $7, ->16
          4    >   ASSIGN_DIM                                               !1, 1
          5        OP_DATA                                                  $7
          6        ASSIGN_DIM                                               !1, 0
          7        OP_DATA                                                  ~9
   15     8        FETCH_DIM_R                                      ~11     !1, 0
          9        ROPE_INIT                                     4  ~14     ~11
         10        ROPE_ADD                                      1  ~14     ~14, '+%3D%3E+'
         11        FETCH_DIM_R                                      ~12     !1, 1
         12        ROPE_ADD                                      2  ~14     ~14, ~12
         13        ROPE_END                                      3  ~13     ~14, '%2C'
         14        ECHO                                                     ~13
   14    15      > JMP                                                      ->3
         16    >   FE_FREE                                                  $6
   17    17        ECHO                                                     '%0A'
   19    18        ASSIGN                                                   !2, 0
   20    19        ASSIGN                                                   !1, <array>
   21    20      > FE_RESET_R                                       $18     !0, ->35
         21    > > FE_FETCH_R                                       ~21     $18, $19, ->35
         22    >   ASSIGN_DIM                                               !1
         23        OP_DATA                                                  $19
         24        ASSIGN_DIM                                               !1
         25        OP_DATA                                                  ~21
   22    26        ADD                                              ~23     !2, 1
         27        FETCH_DIM_R                                      ~24     !1, ~23
         28        ECHO                                                     ~24
         29        ECHO                                                     '+%3D%3E+'
         30        FETCH_DIM_R                                      ~25     !1, !2
         31        ECHO                                                     ~25
         32        ECHO                                                     '%2C'
   23    33        ASSIGN_OP                                     1          !2, 2
   21    34      > JMP                                                      ->21
         35    >   FE_FREE                                                  $18
   25    36        ECHO                                                     '%0A'
   27    37        NEW                                              $27     'Test'
         38        DO_FCALL                                      0          
         39        ASSIGN                                                   !3, $27
   28    40      > FE_RESET_R                                       $30     !0, ->54
         41    > > FE_FETCH_R                                       ~33     $30, $31, ->54
         42    >   ASSIGN_OBJ                                               !3, 'valProp'
         43        OP_DATA                                                  $31
         44        ASSIGN_OBJ                                               !3, 'keyProp'
         45        OP_DATA                                                  ~33
   29    46        FETCH_OBJ_R                                      ~35     !3, 'keyProp'
         47        ROPE_INIT                                     4  ~38     ~35
         48        ROPE_ADD                                      1  ~38     ~38, '+%3D%3E+'
         49        FETCH_OBJ_R                                      ~36     !3, 'valProp'
         50        ROPE_ADD                                      2  ~38     ~38, ~36
         51        ROPE_END                                      3  ~37     ~38, '%2C'
         52        ECHO                                                     ~37
   28    53      > JMP                                                      ->41
         54    >   FE_FREE                                                  $30
   31    55        ECHO                                                     '%0A'
   33    56      > FE_RESET_R                                       $40     !0, ->69
         57    > > FE_FETCH_R                                       ~43     $40, $41, ->69
         58    >   ASSIGN_STATIC_PROP                                       'staticValProp', 'Test'
         59        OP_DATA                                                  $41
         60        ASSIGN_STATIC_PROP                                       'staticKeyProp', 'Test2'
         61        OP_DATA                                                  ~43
   34    62        FETCH_STATIC_PROP_R          unknown             ~45     'staticKeyProp'
         63        ECHO                                                     ~45
         64        ECHO                                                     '+%3D%3E+'
         65        FETCH_STATIC_PROP_R          unknown             ~46     'staticValProp'
         66        ECHO                                                     ~46
         67        ECHO                                                     '%2C'
   33    68      > JMP                                                      ->57
         69    >   FE_FREE                                                  $40
   36    70        ECHO                                                     '%0A'
         71      > RETURN                                                   1

Class Test: [no user functions]
Class Test2: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
195.25 ms | 1399 KiB | 13 Q