note 105169 added to function.array-unique
| From: | FriendlyCode at osu1 dot php dot net | Date: | Mon, 01 Aug 2011 10:48:45 +0000 |
| Subject: | note 105169 added to function.array-unique | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182038@lists.php.net to get a copy of this message | ||
Sorry - I just spotted an error with the code I just posted - this is the correct version
<?php
function specified_array_unique($array, $value)
{
$count = 0;
foreach($array as $array_key => $array_value)
{
if ( ($count > 0) && ($array_value == $value) )
{
unset($array[$array_key]);
}
if ($array_value == $value) $count++;
}
return array_filter($array);
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 92.27.58.82
----
Manual Page -- http://www.php.net/manual/en/function.array-unique.php
Edit -- https://master.php.net/note/edit/105169
Del: integrated -- https://master.php.net/note/delete/105169/integrated
Del: useless -- https://master.php.net/note/delete/105169/useless
Del: bad code -- https://master.php.net/note/delete/105169/bad+code
Del: spam -- https://master.php.net/note/delete/105169/spam
Del: non-english -- https://master.php.net/note/delete/105169/non-english
Del: in docs -- https://master.php.net/note/delete/105169/in+docs
Del: other reasons-- https://master.php.net/note/delete/105169
Reject -- https://master.php.net/note/reject/105169
Search -- https://master.php.net/manage/user-notes.php