note 84750 added to function.array-unique
| From: | Dorphalsig at osu1 dot php dot net | Date: | Mon, 28 Jul 2008 16:47:20 +0000 |
| Subject: | note 84750 added to function.array-unique | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-142860@lists.php.net to get a copy of this message | ||
I had a problem with array_unique and multidimensional arrays ... Maybe there's a better way to
do this, but this will work for any dimensional arrays.
function arrayUnique($myArray)
{
if(!is_array($myArray))
return $myArray;
foreach ($myArray as &$myvalue){
$myvalue=serialize($myvalue);
}
$myArray=array_unique($myArray);
foreach ($myArray as &$myvalue){
$myvalue=unserialize($myvalue);
}
return $myArray;
}
----
Server IP: 69.147.83.197
Probable Submitter: 190.66.3.35
----
Manual Page -- http://www.php.net/manual/en/function.array-unique.php
Edit -- https://master.php.net/note/edit/84750
Del: integrated -- https://master.php.net/note/delete/84750/integrated
Del: useless -- https://master.php.net/note/delete/84750/useless
Del: bad code -- https://master.php.net/note/delete/84750/bad+code
Del: spam -- https://master.php.net/note/delete/84750/spam
Del: non-english -- https://master.php.net/note/delete/84750/non-english
Del: in docs -- https://master.php.net/note/delete/84750/in+docs
Del: other reasons-- https://master.php.net/note/delete/84750
Reject -- https://master.php.net/note/reject/84750
Search -- https://master.php.net/manage/user-notes.php