So I have an array like below:
Array
(
[0] => Array
(
[model] => COROLLA
[trim] => L
[msrp] => 16,800
[type] => car
)
[1] => Array
(
[model] => COROLLA
[trim] => LE
[msrp] => 18,300
[type] => car
)
I need to be able to call all unique values of type and iterate through them to return them as if the type is a category. So I need to make a list of all the vehicles with 'car' as a type and another list for all vehicles with 'van' as a type etc. I have this to get unique values:
$type = array();
foreach($cars as $car){
$type[] = $car['type'];
}
$type = array_unique($type);
I am really running into a wall on how to search for their values and return the top level array. i know this is basic but I am struggling.