3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ (object) ['id' => 1, 'category' => 'Pizza', 'product' => 'Large Pizza', 'complement_type' => 'Bread', 'option' => 'Brown bread'], (object) ['id' => 2, 'category' => 'Pizza', 'product' => 'Small Pizza', 'complement_type' => 'Bread', 'option' => 'White bread'], (object) ['id' => 3, 'category' => 'Pizza', 'product' => 'Small Pizza', 'complement_type' => 'Ingredients', 'option' => 'Olives'], (object) ['id' => 4, 'category' => 'Salads', 'product' => 'Green Salad', 'complement_type' => 'Extras', 'option' => 'Bacon'], (object) ['id' => 5, 'category' => 'Salads', 'product' => 'Cesars Salad', 'complement_type' => 'Extras', 'option' => 'Lettuce'], ]; $result = []; foreach ($array as $obj) { $result[$obj->category][$obj->product][$obj->complement_type] = $obj->option; } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 23
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 23
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/aNe4a
function name:  (null)
number of ops:  28
compiled vars:  !0 = $array, !1 = $result, !2 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   CAST                                          8  ~3      <array>
          1        INIT_ARRAY                                       ~4      ~3
    5     2        CAST                                          8  ~5      <array>
          3        ADD_ARRAY_ELEMENT                                ~4      ~5
    6     4        CAST                                          8  ~6      <array>
          5        ADD_ARRAY_ELEMENT                                ~4      ~6
    7     6        CAST                                          8  ~7      <array>
          7        ADD_ARRAY_ELEMENT                                ~4      ~7
    8     8        CAST                                          8  ~8      <array>
          9        ADD_ARRAY_ELEMENT                                ~4      ~8
    3    10        ASSIGN                                                   !0, ~4
   11    11        ASSIGN                                                   !1, <array>
   12    12      > FE_RESET_R                                       $11     !0, ->23
         13    > > FE_FETCH_R                                               $11, !2, ->23
   13    14    >   FETCH_OBJ_R                                      ~12     !2, 'category'
         15        FETCH_OBJ_R                                      ~14     !2, 'product'
         16        FETCH_OBJ_R                                      ~16     !2, 'complement_type'
         17        FETCH_OBJ_R                                      ~18     !2, 'option'
         18        FETCH_DIM_W                                      $13     !1, ~12
         19        FETCH_DIM_W                                      $15     $13, ~14
         20        ASSIGN_DIM                                               $15, ~16
         21        OP_DATA                                                  ~18
   12    22      > JMP                                                      ->13
         23    >   FE_FREE                                                  $11
   15    24        INIT_FCALL                                               'var_export'
         25        SEND_VAR                                                 !1
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.06 ms | 999 KiB | 14 Q