Re: Re: Removing an Array Element
| From: | Christian Reiniger | Date: | Thu, 25 Oct 2001 09:03:14 +0000 |
| Subject: | Re: Re: Removing an Array Element | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-72223@lists.php.net to get a copy of this message | ||
On Wednesday 24 October 2001 23:33, Jason Caldwell wrote:
> That won't work, as that will only unset the *value* not the *element*.
Try again:
$myArray =
array('100'=>'jibberjabber','200'=>'morejibberjabber','0'=>'----');
var_dump ($myArray);
echo "<br>";
if(isset($myArray[0])) {
unset ($myArray [0]);
}
var_dump ($myArray);
Outputs:
array(3) { [100]=> string(12) "jibberjabber" [200]=> string(16)
"morejibberjabber" [0]=> string(4) "----" }
array(2) { [100]=> string(12) "jibberjabber" [200]=> string(16)
"morejibberjabber" }
-> index 0 is gone.
--
Christian Reiniger
LGDC Webmaster (http://lgdc.sunsite.dk/)
/* you are not expected to understand this */
- from the UNIX V6 kernel source