__clone arguments
| From: | Eduardo R. Maciel | Date: | Wed, 03 Dec 2003 18:14:06 +0000 |
| Subject: | __clone arguments | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-6135@lists.php.net to get a copy of this message | ||
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/