note 21115 deleted from ref.array by philip
| From: | philip@php.net | Date: | Mon, 13 May 2002 03:13:07 +0000 |
| Subject: | note 21115 deleted from ref.array by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-30567@lists.php.net to get a copy of this message | ||
There is no specific function that will remove an item from an array. However, it's not
impossible:
function RemoveItemFromList($list, $item) {
if(is_array($list) {
$newlist = "";
$listitems = explode(",", $list);
$listitems = array_diff($listitems, (array)$item);
$newlist = implode(",", $listitems);
} else {
$newlist = NULL;
print("Wrong datatype in RemoveItemFromList(); call in
<B>$SCRIPT_NAME</B>.\n<BR><BR>");
}
return $newlist;
}