RE: [PHP] Delete array element

From: Date: Thu, 12 Dec 2002 02:37:18 +0000
Subject: RE: [PHP] Delete array element
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-127949@lists.php.net to get a copy of this message
> How can I delete a key and it's value from an array? > > for example: > > $test = array(0=>'yes', 2=>'no', 5=>'maybe', > 7=>'so'); > > And I wanted to delete the second key "2" so I could end up with an array > like so: > > $test = array(0=>'yes', 5=>'maybe', 7=>'so'); unset($test[2]); ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

« previous php.general (#127949) next »