Re: Get reference count on a variable.
| From: | Daniel Schierbeck | Date: | Sat, 21 Aug 2004 18:38:12 +0000 |
| Subject: | Re: Get reference count on a variable. | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-194403@lists.php.net to get a copy of this message | ||
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;
Cheers, Daniel