note 39644 added to ref.array
| From: | anakin at rn2 dot php dot net | Date: | Thu, 05 Feb 2004 21:26:20 +0000 |
| Subject: | note 39644 added to ref.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-64700@lists.php.net to get a copy of this message | ||
Function working like below should be added in new PHP version. Just useful one...
function array_delete($array) {
if (($cnt = func_num_args()) < 2) return False;
for ($nr = 1; $nr < $cnt; $nr++) {
$v = func_get_arg($nr);
while (($k = array_search($v, $array)) !== False)
unset($array[$k]);
}
return $array;
}
// Usage:
$testArray = array('1', '2', '1', '3');
print_r(array_delete($testArray, '1', '2'));
----
Manual Page -- http://www.php.net/manual/en/ref.array.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39644
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39644&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39644&report=yes
Search -- http://master.php.net/manage/user-notes.php