| 
 Posted by Chung Leong on 12/07/05 20:06 
ZeldorBlat wrote: 
> Chung Leong wrote: 
> > Is there anything funcationally difference between the following 
> > snippets: 
> > 
> > // first 
> > $lines[] = array(); 
> > $line =& $lines[count($lines) - 1]; 
> > 
> > // second 
> > $line = array(); 
> > $lines[] =& $line; 
> > 
> > They should do the thing. A voice in my head though is saying there's a 
> > subtle difference. 
> 
> They look the same to me -- at the end of the day both $line and 
> $lines[0] point to the same, empty array.  Of course #2 is more 
> readable and straightforward. 
 
I think you're right. My concern was that in the first block, an array 
was added to $lines, while in the second, a reference was added. 
Momentarily I forgot that references don't exist as discrete objects. 
 
Thanks.
 
[Back to original message] 
 |