复制方法里面的两句话可有可无啊!!
<?php
class Car {
public $name = 'car';
public function __clone() {
// $obj = new Car();
// $obj->name = $this->name;
}
}
$a = new Car();
$a->name = 'new car';
$b = clone $a;
if($a == $b){
echo "yes!!";
}
echo $b -> name;
输出结果是yes!!new car
说明魔方函数里面的两句话没用啊!!!那这两句话是干嘛的,难道真的可有可无??