3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ 'division' => 'Mymensingh', 'A' => 1 ], [ 'division' => 'Dhaka', 'A' => 5 ], [ 'division' => 'Mymensingh', 'B' => 2, 'C' => 5 ] ]; var_export( array_values( array_reduce( $array, function($result, $row) { $result[$row['division']] = ($result[$row['division']] ?? []) + $row; return $result; }, [] ) ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vNFCD
function name:  (null)
number of ops:  14
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   19     1        INIT_FCALL                                               'var_export'
   20     2        INIT_FCALL                                               'array_values'
   21     3        INIT_FCALL                                               'array_reduce'
   22     4        SEND_VAR                                                 !0
   23     5        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   26     6        SEND_VAL                                                 ~2
   27     7        SEND_VAL                                                 <array>
   21     8        DO_ICALL                                         $3      
   27     9        SEND_VAR                                                 $3
   20    10        DO_ICALL                                         $4      
   27    11        SEND_VAR                                                 $4
   19    12        DO_ICALL                                                 
   30    13      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vNFCD
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $result, !1 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   24     2        FETCH_DIM_R                                      ~2      !1, 'division'
          3        FETCH_DIM_R                                      ~4      !1, 'division'
          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
   25    10      > RETURN                                                   !0
   26    11*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.15 ms | 1012 KiB | 16 Q