I have an array like this:
$a = array(
0 => array(\'type\' => \'bar\', \'image\' => \'a.jpg\'),
1 => array(\'type\' => \'food\', \'ima
In PHP >= 5.3 with the use of anonymous functions:
$unique_types = array_unique(array_map(function($elem){return $elem['type'];}, $a));
For previous versions you can declare a separate function:
function get_type($elem)
{
return $elem['type'];
}
$unique_types = array_unique(array_map("get_type", $a));