You are here: Re: OO PHP Referencing an instance of a class « PHP Programming Language « IT news, forums, messages
Re: OO PHP Referencing an instance of a class

Posted by David Haynes on 04/11/06 20:36

Areric wrote:
> SO what is the point of the &. I tried that option as well and was told
> on another site i should use & to make a reference to the class?
>
Think of '&' as 'address of'.

So $bar = & new Bar();

is '$bar equals the address of the instance of the class Bar'

To use it, you would have to dereference it twice (once to resolve the
reference and once to resolve the instance).

So if Bar had a method foo(), you would access it as:

$$bar->foo();

As Justin points out, if you really want to use reference to instances
and not just instances, then there is loads of support in PHP5.

-david-

 

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

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