clearing the behaviour of unset()
| From: | Konstantin Schukraft | Date: | Mon, 21 Jul 2003 10:04:54 +0000 |
| Subject: | clearing the behaviour of unset() | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969355405@lists.php.net to get a copy of this message | ||
hi,
I experimented a little with unset() and found out the following behaviour which on the first look
seems to be contrary to what is mentioned in the docs:
<?php
$a[0]=0;
$a[1]=1;
$a[2]=2;
foo($a);
function foo(&$b)
{
unset($b[1]);
var_dump($b);
}
var_dump($a);
?>
both var_dump()s will output an array with only two fields (0 and 2) and not one with two and one
with three fields like you should think it does if you read the docs.
I don't think that's really a contradiction to what the docs say, however, it should be
mentioned.
cu,
Konstantin Schukraft