note 105167 added to function.array-filter
| From: | FriendlyCode at osu1 dot php dot net | Date: | Mon, 01 Aug 2011 10:36:06 +0000 |
| Subject: | note 105167 added to function.array-filter | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182036@lists.php.net to get a copy of this message | ||
I required a function that removed a specific duplicate entry from an array and ignoring all others
so came up with this:
function specified_array_unique($array, $value)
{
$count = 0;
foreach($array as $array_item)
{
if ( ($count > 0) && ($array_item == $value) )
{
unset($array[$array_item]);
}
if ($array_item == $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-filter.php
Edit -- https://master.php.net/note/edit/105167
Del: integrated -- https://master.php.net/note/delete/105167/integrated
Del: useless -- https://master.php.net/note/delete/105167/useless
Del: bad code -- https://master.php.net/note/delete/105167/bad+code
Del: spam -- https://master.php.net/note/delete/105167/spam
Del: non-english -- https://master.php.net/note/delete/105167/non-english
Del: in docs -- https://master.php.net/note/delete/105167/in+docs
Del: other reasons-- https://master.php.net/note/delete/105167
Reject -- https://master.php.net/note/reject/105167
Search -- https://master.php.net/manage/user-notes.php