// deletes the same elements in the array and keeps only one same element Element
function formatArray($array)
{
sort($array);
$tem = ”;
$temarray = array();
$j = 0;
for($i=0;$i
if($array[$i]!=$tem)
{
$temar (www.111cn.net)ray[$j] = $array[$i];
$j++;
}
$tem = $array[$i];
}
return $temarray;
}
//Test calling function
$array = array('aa','bb','aa',3,4,5,5,5,5,'bc ');
$arr = formatArray($array);
print_r($arr);
?>
from:http://www.111cn.net/phper/php/63531 .htm
array_unique($array); can directly remove duplicate values
array_unique($str);
Use this function to directly delete the same value