How to remove duplicate values from an associative array based on a specific value?

前端 未结 5 947
再見小時候
再見小時候 2020-12-20 01:37

I have an array that looks just like that:

array(3) { [\"fk_article_id\"]=> string(1) \"4\" [\"first_name\"]=> string(6) \"Ulrike\" [\"last_name\"]=>         


        
5条回答
  •  清酒与你
    2020-12-20 02:16

    foreach($array as $key => $value){
        if(!in_array( $array[$key]['fk_article_id'], $usedValues)){
            $usedValues = $array[$key]['fk_article_id'];
            $cleanArray = $array[$key];
        }
    }
    

    something along thoose lines should do it, i don't think there is an pre existing array funciton for that

提交回复
热议问题