3v4l.org

run code in 300+ PHP versions simultaneously
<?php $products = array(); class Products { public $chemID; public $catID; } $prod1 = new Products; $prod1->chemID=1; $prod1->catID=1; array_push($products,$prod1); for($i = 1; $i < 5; $i++) { ${'prod'.$i} = new Products; ${'prod'.$i}->chemID = $i; ${'prod'.$i}->catID = $i; array_push($products,${'prod'.$i}); } $carts = (object)array(array("chemID"=> 1, "catID" => 4),array("chemID"=> 2, "catID" => 4), array("chemID"=> 1, "catID" => 1)); var_dump($carts); foreach($products as $pkey=>$pobj) { foreach($carts as $ckey=>$cvalue) { echo $ckey . ' ' .$cvalue; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 14
Branch analysis from position: 36
2 jumps found. (Code = 77) Position 1 = 42, Position 2 = 53
Branch analysis from position: 42
2 jumps found. (Code = 78) Position 1 = 43, Position 2 = 53
Branch analysis from position: 43
2 jumps found. (Code = 77) Position 1 = 45, Position 2 = 51
Branch analysis from position: 45
2 jumps found. (Code = 78) Position 1 = 46, Position 2 = 51
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
Branch analysis from position: 51
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 53
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 14
Branch analysis from position: 36
Branch analysis from position: 14
filename:       /in/v3iOA
function name:  (null)
number of ops:  55
compiled vars:  !0 = $products, !1 = $prod1, !2 = $i, !3 = $carts, !4 = $pobj, !5 = $pkey, !6 = $cvalue, !7 = $ckey
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    8     1        NEW                                              $9      'Products'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $9
    9     4        ASSIGN_OBJ                                               !1, 'chemID'
          5        OP_DATA                                                  1
   10     6        ASSIGN_OBJ                                               !1, 'catID'
          7        OP_DATA                                                  1
   11     8        INIT_FCALL                                               'array_push'
          9        SEND_REF                                                 !0
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   12    12        ASSIGN                                                   !2, 1
         13      > JMP                                                      ->34
   13    14    >   CONCAT                                           ~16     'prod', !2
         15        NEW                                              $18     'Products'
         16        DO_FCALL                                      0          
         17        FETCH_W                      local               $17     ~16
         18        ASSIGN                                                   $17, $18
   14    19        CONCAT                                           ~21     'prod', !2
         20        FETCH_W                      local               $22     ~21
         21        ASSIGN_OBJ                                               $22, 'chemID'
         22        OP_DATA                                                  !2
   15    23        CONCAT                                           ~24     'prod', !2
         24        FETCH_W                      local               $25     ~24
         25        ASSIGN_OBJ                                               $25, 'catID'
         26        OP_DATA                                                  !2
   16    27        INIT_FCALL                                               'array_push'
         28        SEND_REF                                                 !0
         29        CONCAT                                           ~27     'prod', !2
         30        FETCH_R                      local               ~28     ~27
         31        SEND_VAL                                                 ~28
         32        DO_ICALL                                                 
   12    33        PRE_INC                                                  !2
         34    >   IS_SMALLER                                               !2, 5
         35      > JMPNZ                                                    ~31, ->14
   18    36    >   CAST                                          8  ~32     <array>
         37        ASSIGN                                                   !3, ~32
   19    38        INIT_FCALL                                               'var_dump'
         39        SEND_VAR                                                 !3
         40        DO_ICALL                                                 
   20    41      > FE_RESET_R                                       $35     !0, ->53
         42    > > FE_FETCH_R                                       ~36     $35, !4, ->53
         43    >   ASSIGN                                                   !5, ~36
   21    44      > FE_RESET_R                                       $38     !3, ->51
         45    > > FE_FETCH_R                                       ~39     $38, !6, ->51
         46    >   ASSIGN                                                   !7, ~39
   22    47        CONCAT                                           ~41     !7, '+'
         48        CONCAT                                           ~42     ~41, !6
         49        ECHO                                                     ~42
   21    50      > JMP                                                      ->45
         51    >   FE_FREE                                                  $38
   20    52      > JMP                                                      ->42
         53    >   FE_FREE                                                  $35
   24    54      > RETURN                                                   1

Class Products: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.4 ms | 1400 KiB | 17 Q