note 70034 added to function.array-unique
| From: | keneks at gmail dot com | Date: | Sat, 30 Sep 2006 14:01:18 +0000 |
| Subject: | note 70034 added to function.array-unique | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-117884@lists.php.net to get a copy of this message | ||
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 -- https://master.php.net/note/delete/70034/integrated
Del: useless -- https://master.php.net/note/delete/70034/useless
Del: bad code -- https://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 -- https://master.php.net/note/delete/70034/in+docs
Del: other reasons-- https://master.php.net/note/delete/70034
Reject -- https://master.php.net/note/reject/70034
Search -- https://master.php.net/manage/user-notes.php