note 105168 added to function.array-filter
| From: | FriendlyCode at osu1 dot php dot net | Date: | Mon, 01 Aug 2011 10:36:50 +0000 |
| Subject: | note 105168 added to function.array-filter | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182037@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:
<?php
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/105168
Del: integrated -- https://master.php.net/note/delete/105168/integrated
Del: useless -- https://master.php.net/note/delete/105168/useless
Del: bad code -- https://master.php.net/note/delete/105168/bad+code
Del: spam -- https://master.php.net/note/delete/105168/spam
Del: non-english -- https://master.php.net/note/delete/105168/non-english
Del: in docs -- https://master.php.net/note/delete/105168/in+docs
Del: other reasons-- https://master.php.net/note/delete/105168
Reject -- https://master.php.net/note/reject/105168
Search -- https://master.php.net/manage/user-notes.php