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