note 21115 added to ref.array
| From: | liam_nospam_gibbs at yahoo dot com | Date: | Mon, 29 Apr 2002 19:27:18 +0000 |
| Subject: | note 21115 added to ref.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-29991@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;
}
--
http://www.php.net/manual/en/ref.array.php
http://master.php.net/manage/user-notes.php?action=edit+21115
http://master.php.net/manage/user-notes.php?action=delete+21115
http://master.php.net/manage/user-notes.php?action=reject+21115