3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Products { public $barrels; } $products = array(); for($i = 0; $i < 5; $i++) { ${'prod'.$i} = new Products; ${'prod'.$i}->barrels->chemID = $i; ${'prod'.$i}->barrels->catID = $i; array_push($products,${'prod'.$i}); } var_dump($products); class Carts { public $chemID; public $catID; } $carts = array(); for($i = 0; $i < 5; $i++) { ${'cart'.$i} = new Carts; ${'cart'.$i}->chemID = ($i % 2 == 0 ? $i : $i + 2); ${'cart'.$i}->catID = ($i % 2 == 0 ? $i : $i + 3); array_push($carts,${'cart'.$i}); } var_dump($carts); $cnt = 0; foreach($products as $pkey=>$pobj) { foreach($carts as $ckey=>$cobj) { if($cobj->chemID == $pobj->barrels->chemID && $cobj->catID == $pobj->barrels->catID) { $cnt++; } } } echo 'Count of matches: ' . $cnt;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 3
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 33
Branch analysis from position: 69
2 jumps found. (Code = 77) Position 1 = 74, Position 2 = 94
Branch analysis from position: 74
2 jumps found. (Code = 78) Position 1 = 75, Position 2 = 94
Branch analysis from position: 75
2 jumps found. (Code = 77) Position 1 = 77, Position 2 = 92
Branch analysis from position: 77
2 jumps found. (Code = 78) Position 1 = 78, Position 2 = 92
Branch analysis from position: 78
2 jumps found. (Code = 46) Position 1 = 84, Position 2 = 89
Branch analysis from position: 84
2 jumps found. (Code = 43) Position 1 = 90, Position 2 = 91
Branch analysis from position: 90
1 jumps found. (Code = 42) Position 1 = 77
Branch analysis from position: 77
Branch analysis from position: 91
Branch analysis from position: 89
Branch analysis from position: 92
1 jumps found. (Code = 42) Position 1 = 74
Branch analysis from position: 74
Branch analysis from position: 92
Branch analysis from position: 94
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 94
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 44
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 53, Position 2 = 55
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 33
Branch analysis from position: 69
Branch analysis from position: 33
Branch analysis from position: 55
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 33
Branch analysis from position: 69
Branch analysis from position: 33
Branch analysis from position: 44
2 jumps found. (Code = 43) Position 1 = 53, Position 2 = 55
Branch analysis from position: 53
Branch analysis from position: 55
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 3
Branch analysis from position: 27
Branch analysis from position: 3
filename:       /in/uXFIq
function name:  (null)
number of ops:  98
compiled vars:  !0 = $products, !1 = $i, !2 = $carts, !3 = $cnt, !4 = $pobj, !5 = $pkey, !6 = $cobj, !7 = $ckey
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                       !0, <array>
    8     1        ASSIGN                                                       !1, 0
          2      > JMP                                                          ->25
    9     3    >   CONCAT                                               ~10     'prod', !1
          4        NEW                                                  $12     'Products'
          5        DO_FCALL                                          0          
          6        FETCH_W                          local               $11     ~10
          7        ASSIGN                                                       $11, $12
   10     8        CONCAT                                               ~15     'prod', !1
          9        FETCH_W                          local               $16     ~15
         10        FETCH_OBJ_W                                          $17     $16, 'barrels'
         11        ASSIGN_OBJ                                                   $17, 'chemID'
         12        OP_DATA                                                      !1
   11    13        CONCAT                                               ~19     'prod', !1
         14        FETCH_W                          local               $20     ~19
         15        FETCH_OBJ_W                                          $21     $20, 'barrels'
         16        ASSIGN_OBJ                                                   $21, 'catID'
         17        OP_DATA                                                      !1
   12    18        INIT_FCALL                                                   'array_push'
         19        SEND_REF                                                     !0
         20        CONCAT                                               ~23     'prod', !1
         21        FETCH_R                          local               ~24     ~23
         22        SEND_VAL                                                     ~24
         23        DO_ICALL                                                     
    8    24        PRE_INC                                                      !1
         25    >   IS_SMALLER                                                   !1, 5
         26      > JMPNZ                                                        ~27, ->3
   14    27    >   INIT_FCALL                                                   'var_dump'
         28        SEND_VAR                                                     !0
         29        DO_ICALL                                                     
   21    30        ASSIGN                                                       !2, <array>
   22    31        ASSIGN                                                       !1, 0
         32      > JMP                                                          ->67
   23    33    >   CONCAT                                               ~31     'cart', !1
         34        NEW                                                  $33     'Carts'
         35        DO_FCALL                                          0          
         36        FETCH_W                          local               $32     ~31
         37        ASSIGN                                                       $32, $33
   24    38        CONCAT                                               ~36     'cart', !1
         39        MOD                                                  ~39     !1, 2
         40        IS_EQUAL                                                     ~39, 0
         41      > JMPZ                                                         ~40, ->44
         42    >   QM_ASSIGN                                            ~41     !1
         43      > JMP                                                          ->46
         44    >   ADD                                                  ~42     !1, 2
         45        QM_ASSIGN                                            ~41     ~42
         46    >   FETCH_W                          local               $37     ~36
         47        ASSIGN_OBJ                                                   $37, 'chemID'
         48        OP_DATA                                                      ~41
   25    49        CONCAT                                               ~43     'cart', !1
         50        MOD                                                  ~46     !1, 2
         51        IS_EQUAL                                                     ~46, 0
         52      > JMPZ                                                         ~47, ->55
         53    >   QM_ASSIGN                                            ~48     !1
         54      > JMP                                                          ->57
         55    >   ADD                                                  ~49     !1, 3
         56        QM_ASSIGN                                            ~48     ~49
         57    >   FETCH_W                          local               $44     ~43
         58        ASSIGN_OBJ                                                   $44, 'catID'
         59        OP_DATA                                                      ~48
   26    60        INIT_FCALL                                                   'array_push'
         61        SEND_REF                                                     !2
         62        CONCAT                                               ~50     'cart', !1
         63        FETCH_R                          local               ~51     ~50
         64        SEND_VAL                                                     ~51
         65        DO_ICALL                                                     
   22    66        PRE_INC                                                      !1
         67    >   IS_SMALLER                                                   !1, 5
         68      > JMPNZ                                                        ~54, ->33
   28    69    >   INIT_FCALL                                                   'var_dump'
         70        SEND_VAR                                                     !2
         71        DO_ICALL                                                     
   29    72        ASSIGN                                                       !3, 0
   30    73      > FE_RESET_R                                           $57     !0, ->94
         74    > > FE_FETCH_R                                           ~58     $57, !4, ->94
         75    >   ASSIGN                                                       !5, ~58
   31    76      > FE_RESET_R                                           $60     !2, ->92
         77    > > FE_FETCH_R                                           ~61     $60, !6, ->92
         78    >   ASSIGN                                                       !7, ~61
   32    79        FETCH_OBJ_R                                          ~63     !6, 'chemID'
         80        FETCH_OBJ_R                                          ~64     !4, 'barrels'
         81        FETCH_OBJ_R                                          ~65     ~64, 'chemID'
         82        IS_EQUAL                                             ~66     ~63, ~65
         83      > JMPZ_EX                                              ~66     ~66, ->89
         84    >   FETCH_OBJ_R                                          ~67     !6, 'catID'
         85        FETCH_OBJ_R                                          ~68     !4, 'barrels'
         86        FETCH_OBJ_R                                          ~69     ~68, 'catID'
         87        IS_EQUAL                                             ~70     ~67, ~69
         88        BOOL                                                 ~66     ~70
         89    > > JMPZ                                                         ~66, ->91
   33    90    >   PRE_INC                                                      !3
   31    91    > > JMP                                                          ->77
         92    >   FE_FREE                                                      $60
   30    93      > JMP                                                          ->74
         94    >   FE_FREE                                                      $57
   37    95        CONCAT                                               ~72     'Count+of+matches%3A+', !3
         96        ECHO                                                         ~72
         97      > RETURN                                                       1

Class Products: [no user functions]
Class Carts: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
166.13 ms | 1718 KiB | 10 Q