Re: Re: Delete element from an array (PHP3)

From: Date: Sat, 06 Oct 2001 11:04:26 +0000
Subject: Re: Re: Delete element from an array (PHP3)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-70241@lists.php.net to get a copy of this message
Richard, Unfortunately unset() isn't working for this on two different versions of PHP3 that I've tried. It seems the element is empty, but the reference is still there. Something seems to have changed in PHP4 when passing a multi-dimensioned array to a function and calling unset() on an element... >unset() should work... > >There were (beta?) versions where it would leave behind some detrius, but >IIRC, you were safe if you used list/each... > >> 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 (#70241) next »