Afficher un message
Vieux 18/01/2008, 19h13   #2
Rik Wasmus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Copying an Object passes Object by Reference?!

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
  Réponse avec citation
 
Page generated in 0,06346 seconds with 9 queries