Re: Перевод мануал а
| From: | Antony Dovgal | Date: | Tue, 22 Apr 2008 14:06:00 +0000 |
| Subject: | Re: Перевод мануал а | ||
| References: | 1 2 3 4 5 | Groups: | php.doc.ru |
| Request: | Send a blank email to doc-ru+get-936@lists.php.net to get a copy of this message | ||
On 22.04.2008 16:38, Maxim Antonov wrote:
Ну вот на этом я споткнулся...Там же на строчку выше сказано: Since PHP 5, new return reference automatically so using =& in this context is deprecated and produces E_STRICT level message.
Note: Not using the & operator causes a copy of the object to be made. If you use $this in the class it will operate on the current instance of the class. The assignment without & will copy the instance (i.e. the object) and $this will operate on the copy, which is not always what is desired.
Насколько я понимаю в пятерке идет по ссылке такая конструкция: $this->child = new Child($this);В пятёрке переменная-объект просто хранит номер объекта в object storage, поэтому присваивай-не присваивай - ID объекта тот же самый и все переменные будут ссылаться на тот же самый объект. -- Wbr, Antony Dovgal