Taking the advantage of array_unique, here is a simple
function to check if an array has duplicate values.
It simply compares the number of elements between the
original array and the array_uniqued array.
function array_search_dups($array)
{
$dup_array = $array;
$dup_array = array_unique($dup_array);
if(count($dup_array) != count($array))
{
return TRUE;
}
else
{
return FALSE;
}
}
----
Server IP: 66.207.199.35
Probable Submitter: 24.87.112.34
----
Manual Page -- http://www.php.net/manual/en/function.array-unique.php
Edit -- https://master
.php.net/note/edit/70034
Del: integrated -- h
ttps://master.php.net/note/delete/70034/integrated
Del: useless -- http
s://master.php.net/note/delete/70034/useless
Del: bad code -- htt
ps://master.php.net/note/delete/70034/bad+code
Del: spam -- https:/
/master.php.net/note/delete/70034/spam
Del: non-english --
https://master.php.net/note/delete/70034/non-english
Del: in docs -- http
s://master.php.net/note/delete/70034/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/70034
Reject -- https://mast
er.php.net/note/reject/70034
Search -- https://
master.php.net/manage/user-notes.php
--
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|