Re: __clone arguments
| From: | Andi Gutmans | Date: | Wed, 03 Dec 2003 20:39:06 +0000 |
| Subject: | Re: __clone arguments | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-6138@lists.php.net to get a copy of this message | ||
It doesn't accept arguments. An object should know how to clone itself without additional information. If you want a method which does something other than cloning then define your own method.
Andi
At 10:14 AM 12/3/2003 -0800, Eduardo R. Maciel wrote:
Sorry if it has been discussed before, but how is the question about __clone accept arguments ??? It would permit a better control when clonning objects, like dinamically setting properties. Sure its is possible using wrappers, but would be better if the function supports that. class clonable{public $age; public $b;// function __clone($a){ // if ($a) $this->age = $a; // else $this->age = $that->age; // }} $molly = new clonable; $molly->age = 1; $dolly = $molly->__clone(0); echo $dolly->age; if ($dolly == $molly) echo "equal: TRUE"; else {var_dump($dolly); var_dump($molly);} if ($dolly === $molly) echo "identical: TRUE"; else {var_dump($dolly); var_dump($molly);} Eduardo R. Maciel __________________________________ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php