note 24215 deleted from function.array-splice by kennyt

From: Date: Mon, 05 Jan 2004 02:41:06 +0000
Subject: note 24215 deleted from function.array-splice by kennyt
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-62926@lists.php.net to get a copy of this message
Note Submitter: randy@cheerylynn.com ---- ////////////////////////////////////////////////////// //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. ; ) //////////////////////////////////////////

« previous php.notes (#62926) next »