<?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 '=='; //true
if ($a === $b) echo '==='; //false
属性和值都相等,但存储在两块不一样的内存中,就是说指向的内存地址不同,每个对象都有相对应的内存地址