You are here: Re: Any difference between these two? « PHP Programming Language « IT news, forums, messages
Re: Any difference between these two?

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация