3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ ["ID" => 2, "vendor_id" => "37", "order_id" => 776], ], [ ["ID" => 2, "vendor_id" => "37", "order_id" => 786], ] ]; var_export( array_reduce( $array, function ($carry, $group) { foreach ($group as $row) { $carry[$row['order_id']][] = $row; } return $carry; } ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0ETGA
function name:  (null)
number of ops:  10
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   12     1        INIT_FCALL                                               'var_export'
   13     2        INIT_FCALL                                               'array_reduce'
   14     3        SEND_VAR                                                 !0
   15     4        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   20     5        SEND_VAL                                                 ~2
   13     6        DO_ICALL                                         $3      
   20     7        SEND_VAR                                                 $3
   12     8        DO_ICALL                                                 
   22     9      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/0ETGA
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $carry, !1 = $group, !2 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2      > FE_RESET_R                                       $3      !1, ->9
          3    > > FE_FETCH_R                                               $3, !2, ->9
   17     4    >   FETCH_DIM_R                                      ~4      !2, 'order_id'
          5        FETCH_DIM_W                                      $5      !0, ~4
          6        ASSIGN_DIM                                               $5
          7        OP_DATA                                                  !2
   16     8      > JMP                                                      ->3
          9    >   FE_FREE                                                  $3
   19    10      > RETURN                                                   !0
   20    11*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.32 ms | 1011 KiB | 15 Q