3v4l.org

run code in 300+ PHP versions simultaneously
<?php $o1 = new stdClass; $o2 = new stdClass; $o3 = new stdClass; $o1->active = false; $o2->active = true; $o3->active = true; $products = [$o1, $o2, $o3]; for($i=0, $max=count($products); $i < $max; $i++) { if (!($products[$i]->active)) { unset($products[$i]); } } print_r($products); // reindex: $improvedProducts = array_values($products); print_r($improvedProducts);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 23
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 28
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 23
Branch analysis from position: 31
Branch analysis from position: 23
Branch analysis from position: 28
filename:       /in/CfM0N
function name:  (null)
number of ops:  42
compiled vars:  !0 = $o1, !1 = $o2, !2 = $o3, !3 = $products, !4 = $i, !5 = $max, !6 = $improvedProducts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $7      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $7
    4     3        NEW                                              $10     'stdClass'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $10
    5     6        NEW                                              $13     'stdClass'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $13
    7     9        ASSIGN_OBJ                                               !0, 'active'
         10        OP_DATA                                                  <false>
    8    11        ASSIGN_OBJ                                               !1, 'active'
         12        OP_DATA                                                  <true>
    9    13        ASSIGN_OBJ                                               !2, 'active'
         14        OP_DATA                                                  <true>
   12    15        INIT_ARRAY                                       ~19     !0
         16        ADD_ARRAY_ELEMENT                                ~19     !1
         17        ADD_ARRAY_ELEMENT                                ~19     !2
         18        ASSIGN                                                   !3, ~19
   15    19        ASSIGN                                                   !4, 0
         20        COUNT                                            ~22     !3
         21        ASSIGN                                                   !5, ~22
         22      > JMP                                                      ->29
   16    23    >   FETCH_DIM_R                                      ~24     !3, !4
         24        FETCH_OBJ_R                                      ~25     ~24, 'active'
         25        BOOL_NOT                                         ~26     ~25
         26      > JMPZ                                                     ~26, ->28
   17    27    >   UNSET_DIM                                                !3, !4
   15    28    >   PRE_INC                                                  !4
         29    >   IS_SMALLER                                               !4, !5
         30      > JMPNZ                                                    ~28, ->23
   20    31    >   INIT_FCALL                                               'print_r'
         32        SEND_VAR                                                 !3
         33        DO_ICALL                                                 
   24    34        INIT_FCALL                                               'array_values'
         35        SEND_VAR                                                 !3
         36        DO_ICALL                                         $30     
         37        ASSIGN                                                   !6, $30
   25    38        INIT_FCALL                                               'print_r'
         39        SEND_VAR                                                 !6
         40        DO_ICALL                                                 
         41      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.09 ms | 1004 KiB | 15 Q