You are here: Re: Copying an Object passes Object by Reference?! « PHP Programming Language « IT news, forums, messages
Re: Copying an Object passes Object by Reference?!

Posted by Rik Wasmus on 01/18/08 18:13

On Fri, 18 Jan 2008 18:57:19 +0100, jerrygarciuh <jerrygarciuh@gmail.com>
wrote:
> I discovered this by accident today. How should I get an object's
> data into another variable and make modifications without affecting
> the original object?

Since PHP5, objects are always passed (& assigned) by reference. Use the
'clone' keyword if you need a clone, and you can even use the magic
__clone() method to alter an object on clone (possibly clone objects in
the properties too etc.).
--
Rik Wasmus

 

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

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