I have written this function to count the number of duplicate values in an array of integers, it works if I manually create the array. It does not if the array is created by “mysql_fetch_array()”. Anyone know what I am missing, or is there a better way to accomplish this with regx?
Thanks!
function int_find_dup($intArray){
$i = 0;
$i2 = 1;
$numDups = 0;
$size = count($intArray);
$intOut = $size;
for ($i; $i<$size; ++$i){
for ($i2; $i2<$size; ++$i2){
if(ereg($intArray[$i], $intArray[$i2]))
++$numDups;
}
--$intOut;
$i2 = ($size - $intOut) + 1;
}
return $numDups;
}