You are passing an array of scalars *by reference* not
by value, so this is the expected behavior because you
are unsetting one item in the array, not the whole
array. Perhaps that should be clarified. It is not
ambiguous in the text when you unset a scalar variable
(see the example there).

A clarification is warranted for arrays and other
non-scalar structures. Although I am not sure this is
a consistent behaviour, I would even suggest
submitting it as a possible bug for the scripting
engine (unless someone has an explanation why arrays
are special in this case).

--- Konstantin Schukraft <[EMAIL PROTECTED]>
wrote:
> 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
> 
> 
> -- 
> PHP Documentation Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

=====
--- Jesus M. Castagnetto <[EMAIL PROTECTED]>

__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com

-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to