关于对象克隆
<?php
class Car {
public $name = 'car';
public function __clone() {
$obj = new Car();
//$obj->name = $this->name;
$obj->name='test';
}
}
$a = new Car();
$a->name = 'new car';
$b = clone $a;
echo $b->name;
?>
我的问题是$b = clone $a;此时$b是指由$a调用__clone生成的对象还是?如果是那么echo $b->name;应该打印的值是‘test’,而实际结果确是 new car