3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ (object) ['ID' => 113, 'title' => 'text'], (object) ['ID' => 114, 'title' => 'text text text'], (object) ['ID' => 115, 'title' => 'text text'], (object) ['ID' => 116, 'title' => 'text'], ]; $result = []; foreach ($array as $obj) { $clone = clone $obj; unset($clone->ID); $result[$obj->ID] = $clone; } var_export($result); echo "\n---\n"; var_export($array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/1ggB6
function name:  (null)
number of ops:  28
compiled vars:  !0 = $array, !1 = $result, !2 = $obj, !3 = $clone
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
    3     8        ASSIGN                                                       !0, ~5
   10     9        ASSIGN                                                       !1, <array>
   11    10      > FE_RESET_R                                           $11     !0, ->19
         11    > > FE_FETCH_R                                                   $11, !2, ->19
   12    12    >   CLONE                                                ~12     !2
         13        ASSIGN                                                       !3, ~12
   13    14        UNSET_OBJ                                                    !3, 'ID'
   14    15        FETCH_OBJ_R                                          ~14     !2, 'ID'
         16        ASSIGN_DIM                                                   !1, ~14
         17        OP_DATA                                                      !3
   11    18      > JMP                                                          ->11
         19    >   FE_FREE                                                      $11
   16    20        INIT_FCALL                                                   'var_export'
         21        SEND_VAR                                                     !1
         22        DO_ICALL                                                     
   18    23        ECHO                                                         '%0A---%0A'
   20    24        INIT_FCALL                                                   'var_export'
         25        SEND_VAR                                                     !0
         26        DO_ICALL                                                     
         27      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
200.08 ms | 1857 KiB | 14 Q