3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ [ "total_process_per_category" => "6", "category_id" => "1" ], [ "total_process_per_category" => "2", "category_id" => "2" ] ]; $array2 = [ [ "total_pinned_per_category" => "16", "category_id" => "1" ], [ "total_pinned_per_category" => "4", "category_id" => "2" ] ]; var_export( array_values( array_reduce( array_merge($array1, $array2), function ($result, $row) { $result[$row['category_id']] = ($result[$row['category_id']] ?? []) + $row; return $result; }, [] ) ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vpehc
function name:  (null)
number of ops:  19
compiled vars:  !0 = $array1, !1 = $array2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1        ASSIGN                                                   !1, <array>
   25     2        INIT_FCALL                                               'var_export'
   26     3        INIT_FCALL                                               'array_values'
   27     4        INIT_FCALL                                               'array_reduce'
   28     5        INIT_FCALL                                               'array_merge'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $4      
          9        SEND_VAR                                                 $4
   29    10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fvpehc%3A29%240'
   32    11        SEND_VAL                                                 ~5
   33    12        SEND_VAL                                                 <array>
         13        DO_ICALL                                         $6      
         14        SEND_VAR                                                 $6
         15        DO_ICALL                                         $7      
         16        SEND_VAR                                                 $7
         17        DO_ICALL                                                 
   36    18      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fvpehc%3A29%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vpehc
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $result, !1 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   30     2        FETCH_DIM_R                                      ~2      !1, 'category_id'
          3        FETCH_DIM_R                                      ~4      !1, 'category_id'
          4        FETCH_DIM_IS                                     ~5      !0, ~4
          5        COALESCE                                         ~6      ~5
          6        QM_ASSIGN                                        ~6      <array>
          7        ADD                                              ~7      ~6, !1
          8        ASSIGN_DIM                                               !0, ~2
          9        OP_DATA                                                  ~7
   31    10      > RETURN                                                   !0
   32    11*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fvpehc%3A29%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.56 ms | 1407 KiB | 21 Q