Re: Delete element from an array (PHP3)

From: Date: Sat, 06 Oct 2001 04:23:48 +0000
Subject: Re: Delete element from an array (PHP3)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-70199@lists.php.net to get a copy of this message
unset() should work... There were (beta?) versions where it would leave behind some detrius, but IIRC, you were safe if you used list/each... -- WARNING richard@zend.com address is an endangered species -- Use ceo@l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: John Steele <johnsteele@earthlink.net> Newsgroups: php.general To: <php-general@lists.php.net> Sent: Friday, October 05, 2001 7:01 AM Subject: Delete element from an array (PHP3) > In PHP4, unset($myarray['3']['someindex'}) removes this element (inside a class function passed $myarray). I need to do the same for PHP3 - what is the simplest way to accomplish this? > > I guess I'm looking for a function that supports PHP3 or PHP4, say: > > function unset_arr ($array) { > if (phpversion() < 4) > // get rid of the array element here... > else > unset ($array); > } > > I'm assuming that I will have to do some shuffling of the array, and possibly return a new array with that element missing? > > Thanks for any help on this, > John > -- > /* SteeleSoft Consulting John Steele - Systems Analyst/Programmer > * We also walk dogs... PHP/MySQL/Linux/Hosting - jsteele@writeme.com > * http://www.steelesoftconsulting.com > */

« previous php.general (#70199) next »