Re: Re: Removing an Array Element
| From: | Papp Gyozo | Date: | Thu, 25 Oct 2001 12:15:38 +0000 |
| Subject: | Re: Re: Removing an Array Element | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-72259@lists.php.net to get a copy of this message | ||
and what about array_slice(), array_splice(), array_pop() or
array_unshift()?
Please read the corresponding pages of the manual!
----- Original Message -----
From: "Christian Reiniger" <creinig@mayn.de>
To: "Jason Caldwell" <jason@thinkingman.org>; <php-general@lists.php.net>
Sent: Thursday, October 25, 2001 11:03 AM
Subject: Re: [PHP] Re: Removing an Array Element
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net