3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array( 0 => (object) (array( 'id' => 1111, 'houseid' => 58, 'price' => 2995, )), 1 => (object) (array( 'id' => 1112, 'houseid' => 58, 'price' => 4050, )), 2 => (object) (array( 'id' => 1114, 'houseid' => 60, 'price' => 1695, )), 3 => (object) (array( 'id' => 1115, 'houseid' => 60, 'price' => 2250, )), 4 => (object) (array( 'id' => 1116, 'houseid' => 60, 'price' => 2295, )), ); $data = array_reduce($data, function ($a, $b) { $id = $b->houseid; unset($b->houseid); $a[$id][] = $b; return $a; }); var_dump($data); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jPMaP
function name:  (null)
number of ops:  21
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   CAST                                          8  ~1      <array>
          1        INIT_ARRAY                                       ~2      ~1, 0
   11     2        CAST                                          8  ~3      <array>
          3        ADD_ARRAY_ELEMENT                                ~2      ~3, 1
   17     4        CAST                                          8  ~4      <array>
          5        ADD_ARRAY_ELEMENT                                ~2      ~4, 2
   23     6        CAST                                          8  ~5      <array>
          7        ADD_ARRAY_ELEMENT                                ~2      ~5, 3
   29     8        CAST                                          8  ~6      <array>
          9        ADD_ARRAY_ELEMENT                                ~2      ~6, 4
    2    10        ASSIGN                                                   !0, ~2
   35    11        INIT_FCALL                                               'array_reduce'
         12        SEND_VAR                                                 !0
         13        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FjPMaP%3A35%240'
   40    14        SEND_VAL                                                 ~8
         15        DO_ICALL                                         $9      
   35    16        ASSIGN                                                   !0, $9
   42    17        INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                                 
   44    20      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FjPMaP%3A35%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jPMaP
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $a, !1 = $b, !2 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   36     2        FETCH_OBJ_R                                      ~3      !1, 'houseid'
          3        ASSIGN                                                   !2, ~3
   37     4        UNSET_OBJ                                                !1, 'houseid'
   38     5        FETCH_DIM_W                                      $5      !0, !2
          6        ASSIGN_DIM                                               $5
          7        OP_DATA                                                  !1
   39     8      > RETURN                                                   !0
   40     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FjPMaP%3A35%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.98 ms | 1396 KiB | 17 Q