我有一個foreach迭代器,裏面有500 group items
。如何刪除foreach中的重複值?php刪除重複的值在foreach
foreach ($data as $data) {
if(!empty($data['name'])){ //check if have $data['name']
$name = $data['name'];
$id = $data['id'];
$date = $data['date'];
$link = $data['link'];
if(strpos($link, '.ads.')){
continue; //remove all the link contains `.ads.`
}else{
// if `$link` is not repeat, echo the below data. how to use array_unique, remove all the values which repear in `$link` part?
echo $name;
echo $id;
echo $date;
echo $link;
}
}
你可以顯示一個示例重複值嗎? – 2011-06-12 13:54:32