Gabriel Birke <birke <at> kontor4.de> writes:

> 
> Hello!
> 
> The following PHP code:
> <?
> $a = array("1"=>"First Element", "2"=>"Second Element");
> $v = &$a['3'];
> print_r($a);
> ?>
> has this result:
> 
> Array(
>       1 => First Element,
>       2 => Second Element,
>       3 =>
> )
> 
> Can anyone give me an explanation for this? What is happening in the 
> guts of the PHP interpreter when it gets these instructions?
> 
> With best regards
> 
> Gabriel Birke
> 

Hi !

As you passed $a in reference while defining $v, the '3' index of $a was 
defined. Furthermore, you didn't at any time affect a value to that '3' index 
of $a, but it exists because he was invocated once...

So the result of your print_r isn't odd ;)

Maybe you know that very well and your question was infinitely more technical, 
but for that I can't answer anymore ;)

Ace

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

Reply via email to