You are here: Re: [PHP] PHP 5 confusion « PHP « IT news, forums, messages
Re: [PHP] PHP 5 confusion

Posted by Richard Lynch on 01/07/05 19:43

> Reading the PHP 5 documentation at: HYPERLINK
> "http://www.php.net/manual/en/language.oop5.basic.php"http://www.php.net/man
> ual/en/language.oop5.basic.php, I am confused.
>
> In the example given, what is the difference between:
> $assigned = $instance;
> $reference =& $instance;
>
> I would expect all of the var_dump to display NULL
>
> The doc says "When assigning an already created instance of an object to a
> new variable, the new variable will access the same instance as the object
> that was assigned." so the above assignments seem the same to me and
> setting
> $instance to NULL should also set $assigned to NULL.

I think they intendeed for you to assume $instance had something in it:

$instance = new foo();
$assigned = $instance;
$reference =& $instance;

--
Like Music?
http://l-i-e.com/artists.htm

 

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

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