Re: Get reference count on a variable.
| From: | Robert Cummings | Date: | Sat, 21 Aug 2004 19:11:10 +0000 |
| Subject: | Re: Get reference count on a variable. | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-194405@lists.php.net to get a copy of this message | ||
On Sat, 2004-08-21 at 14:38, Daniel Schierbeck wrote:
> Robert Cummings wrote:
> > In PHP5 to get a copy of, versus a reference to, an object the developer
> > must call the __clone() method for the target object:
> >
> > $obj = new Foo();
> > $copyNotReference = $obj->__clone();
>
> The correct syntax for that is:
>
> $obj = new Foo;
> $copyNotReference = clone $obj;
Ahh cool. I guess I was reading an old document. Perhaps from before a
keyword was added for better code clarity :)
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'