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; }, [] ) ) );

preferences:
39.01 ms | 406 KiB | 5 Q