PHP traverse category subcategory tree array into a custom 2D array
问题 I have an parent child array similar to this: Array ( [0] => Array ( [category_id] => 1 [category_name] => Home & Garden [parent_id] => 0 [level] => 1 ) [1] => Array ( [category_id] => 2 [category_name] => Kitchen & Dining [parent_id] => 1 [level] => 2 ) [2] => Array ( [category_id] => 3 [category_name] => Food & Beverage Carriers [parent_id] => 2 [level] => 3 ) [3] => Array ( [category_id] => 4 [category_name] => Flasks [parent_id] => 3 [level] => 4 ) [4] => Array ( [category_id] => 5