note 24215 added to function.array-splice
| From: | randy at cheerylynn dot com | Date: | Fri, 09 Aug 2002 15:41:31 +0000 |
| Subject: | note 24215 added to function.array-splice | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-34614@lists.php.net to get a copy of this message | ||
//////////////////////////////////////////////////////
//Pops out a single item from a class member ($items)
//two-dimensional array.
//Where 'item_id_num' == the argument $item_id
function removeItem($item_id)
{
$num_items = count($this->items);
for($i = 0; $i < $num_items; $i++)
{
if($this->items[$i]['item_id_num'] == $item_id)
{
array_splice($this->items,$i,1);
}
}
}
///////////////////////////////////////////
//Yeah, I know it's simple. ; )
//////////////////////////////////////////
--
http://www.php.net/manual/en/function.array-splice.php
http://master.php.net/manage/user-notes.php?action=edit+24215
http://master.php.net/manage/user-notes.php?action=delete+24215
http://master.php.net/manage/user-notes.php?action=reject+24215