|
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]
|