reorganizing

How can I implement a custom reorganization function that returns a nested array?

I have this data coming from a database which pulls all subcategories and relevant info: $data = array( array( 'destination_name' => 'Ohio Resort', 'destination_slug' => 'ohio', 'subcategory_name' => 'Bird Hunting', 'subcategory_slug' => 'bird-hunting', 'category_name' => 'Hunting', 'c...