3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ (object) ['id'=> 1, 'value' => 0], (object) ['id'=> 2, 'value' => 10], (object) ['id'=> 3, 'value' => 14], (object) ['id'=> 4, 'value' => 0], (object) ['id'=> 5, 'value' => 21], (object) ['id'=> 6, 'value' => 44], ]; $result = []; foreach ($array as $obj) { if (!$obj->value) { unset($ref); $obj->values = []; $ref = &$obj->values; $result[] = $obj; continue; } $ref[] = $obj; } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 30
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 30
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 27
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/78YGL
function name:  (null)
number of ops:  35
compiled vars:  !0 = $array, !1 = $result, !2 = $obj, !3 = $ref
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   CAST                                              8  ~4      <array>
          1        INIT_ARRAY                                           ~5      ~4
          2        CAST                                              8  ~6      <array>
          3        ADD_ARRAY_ELEMENT                                    ~5      ~6
          4        CAST                                              8  ~7      <array>
          5        ADD_ARRAY_ELEMENT                                    ~5      ~7
          6        CAST                                              8  ~8      <array>
          7        ADD_ARRAY_ELEMENT                                    ~5      ~8
          8        CAST                                              8  ~9      <array>
          9        ADD_ARRAY_ELEMENT                                    ~5      ~9
         10        CAST                                              8  ~10     <array>
         11        ADD_ARRAY_ELEMENT                                    ~5      ~10
    3    12        ASSIGN                                                       !0, ~5
   12    13        ASSIGN                                                       !1, <array>
   13    14      > FE_RESET_R                                           $13     !0, ->30
         15    > > FE_FETCH_R                                                   $13, !2, ->30
   14    16    >   FETCH_OBJ_R                                          ~14     !2, 'value'
         17        BOOL_NOT                                             ~15     ~14
         18      > JMPZ                                                         ~15, ->27
   15    19    >   UNSET_CV                                                     !3
   16    20        ASSIGN_OBJ                                                   !2, 'values'
         21        OP_DATA                                                      <array>
   17    22        FETCH_OBJ_W                                          $17     !2, 'values'
         23        ASSIGN_REF                                                   !3, $17
   18    24        ASSIGN_DIM                                                   !1
         25        OP_DATA                                                      !2
   19    26      > JMP                                                          ->15
   21    27    >   ASSIGN_DIM                                                   !3
         28        OP_DATA                                                      !2
   13    29      > JMP                                                          ->15
         30    >   FE_FREE                                                      $13
   23    31        INIT_FCALL                                                   'var_export'
         32        SEND_VAR                                                     !1
         33        DO_ICALL                                                     
         34      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
209.39 ms | 2003 KiB | 14 Q