[php] //二維數(shù)組去掉重復(fù)值 function array_unique_fb($array2D){ foreach ($array2D as $v){ $v = join(",",$v); //降維,也可以用implode,將一維數(shù)組轉(zhuǎn)換為用逗號(hào)連接的字符串 $temp[] = $v; } $temp = array_unique($temp); //去掉重復(fù)的字符串,也就是重復(fù)的一維數(shù)組 foreach ($temp as $k => $v){ $temp[$k] = explode(",",$v); //再將拆開的數(shù)組重新組裝 } return $temp; }[/php]
發(fā)表評(píng)論