note 21762 added to function.array-pop

From: Date: Sat, 25 May 2002 19:06:28 +0000
Subject: note 21762 added to function.array-pop
Groups: php.notes 
Request: Send a blank email to php-notes+get-31034@lists.php.net to get a copy of this message
being fairly new to php i had many problems trying to "pop" a key/value pair out of a multiarray. after many hours reading manuals and other notes I find this most reliable... $a[]=array(a,2,3,4,5); $a[]=array(b,2,3,4,5); $a[]=array(c,2,3,4,5); and so on... $limit=count($a); for ($i=1;$i<$limit;$i++){ $target=$a[$i][0]; if ($target<>'b'){ $z[]=$a[$i]; } } $z=$a; not the most complex or spectacular but it's not as cryptic as some others and it can easily be changed to fit most needs -- http://www.php.net/manual/en/function.array-pop.php http://master.php.net/manage/user-notes.php?action=edit+21762 http://master.php.net/manage/user-notes.php?action=delete+21762 http://master.php.net/manage/user-notes.php?action=reject+21762

« previous php.notes (#31034) next »