Get unique value of one attribute from array of associative arrays

后端 未结 5 651
青春惊慌失措
青春惊慌失措 2021-01-18 06:38

I have an array like this:

$a = array(
    0 => array(\'type\' => \'bar\', \'image\' => \'a.jpg\'),
    1 => array(\'type\' => \'food\', \'ima         


        
5条回答
  •  春和景丽
    2021-01-18 07:32

    try this

    $uniqueA = array_unique($a, "type");
    // then to output the array just type
    print_r($uniqueA);
    

提交回复
热议问题