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)); $cnt = 0; foreach($products as $pkey=>$pobj) { foreach($carts as $ckey=>$carray) { if(isset($carray['chemID']) && isset($pobj['chemID'])) { if(isset($carray['catID']) && isset($pobj['catID']) && $carray['catID']==$pobj['catID']) { $cnt++; } } } } echo $cnt;
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 = 40, Position 2 = 64
Branch analysis from position: 40
2 jumps found. (Code = 78) Position 1 = 41, Position 2 = 64
Branch analysis from position: 41
2 jumps found. (Code = 77) Position 1 = 43, Position 2 = 62
Branch analysis from position: 43
2 jumps found. (Code = 78) Position 1 = 44, Position 2 = 62
Branch analysis from position: 44
2 jumps found. (Code = 46) Position 1 = 47, Position 2 = 49
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 61
Branch analysis from position: 50
2 jumps found. (Code = 46) Position 1 = 52, Position 2 = 54
Branch analysis from position: 52
2 jumps found. (Code = 46) Position 1 = 55, Position 2 = 59
Branch analysis from position: 55
2 jumps found. (Code = 43) Position 1 = 60, Position 2 = 61
Branch analysis from position: 60
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
Branch analysis from position: 61
Branch analysis from position: 59
Branch analysis from position: 54
Branch analysis from position: 61
Branch analysis from position: 49
Branch analysis from position: 62
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 62
Branch analysis from position: 64
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 64
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/pNYoU
function name:  (null)
number of ops:  67
compiled vars:  !0 = $products, !1 = $prod1, !2 = $i, !3 = $carts, !4 = $cnt, !5 = $pobj, !6 = $pkey, !7 = $carray, !8 = $ckey
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    8     1        NEW                                              $10     'Products'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $10
    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                                           ~17     'prod', !2
         15        NEW                                              $19     'Products'
         16        DO_FCALL                                      0          
         17        FETCH_W                      local               $18     ~17
         18        ASSIGN                                                   $18, $19
   14    19        CONCAT                                           ~22     'prod', !2
         20        FETCH_W                      local               $23     ~22
         21        ASSIGN_OBJ                                               $23, 'chemID'
         22        OP_DATA                                                  !2
   15    23        CONCAT                                           ~25     'prod', !2
         24        FETCH_W                      local               $26     ~25
         25        ASSIGN_OBJ                                               $26, 'catID'
         26        OP_DATA                                                  !2
   16    27        INIT_FCALL                                               'array_push'
         28        SEND_REF                                                 !0
         29        CONCAT                                           ~28     'prod', !2
         30        FETCH_R                      local               ~29     ~28
         31        SEND_VAL                                                 ~29
         32        DO_ICALL                                                 
   12    33        PRE_INC                                                  !2
         34    >   IS_SMALLER                                               !2, 5
         35      > JMPNZ                                                    ~32, ->14
   18    36    >   CAST                                          8  ~33     <array>
         37        ASSIGN                                                   !3, ~33
   19    38        ASSIGN                                                   !4, 0
   20    39      > FE_RESET_R                                       $36     !0, ->64
         40    > > FE_FETCH_R                                       ~37     $36, !5, ->64
         41    >   ASSIGN                                                   !6, ~37
   21    42      > FE_RESET_R                                       $39     !3, ->62
         43    > > FE_FETCH_R                                       ~40     $39, !7, ->62
         44    >   ASSIGN                                                   !8, ~40
   22    45        ISSET_ISEMPTY_DIM_OBJ                         0  ~42     !7, 'chemID'
         46      > JMPZ_EX                                          ~42     ~42, ->49
         47    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~43     !5, 'chemID'
         48        BOOL                                             ~42     ~43
         49    > > JMPZ                                                     ~42, ->61
   23    50    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~44     !7, 'catID'
         51      > JMPZ_EX                                          ~44     ~44, ->54
         52    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~45     !5, 'catID'
         53        BOOL                                             ~44     ~45
         54    > > JMPZ_EX                                          ~44     ~44, ->59
         55    >   FETCH_DIM_R                                      ~46     !7, 'catID'
         56        FETCH_DIM_R                                      ~47     !5, 'catID'
         57        IS_EQUAL                                         ~48     ~46, ~47
         58        BOOL                                             ~44     ~48
         59    > > JMPZ                                                     ~44, ->61
   24    60    >   PRE_INC                                                  !4
   21    61    > > JMP                                                      ->43
         62    >   FE_FREE                                                  $39
   20    63      > JMP                                                      ->40
         64    >   FE_FREE                                                  $36
   29    65        ECHO                                                     !4
         66      > RETURN                                                   1

Class Products: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.99 ms | 1400 KiB | 15 Q