== O:3:"Car":1:{s:4:"name";s:7:"new car";} object(Car)#3 (1) { ["name"]=> string(7) "new car" }请问为什么是这样的输出结果 啊,我看不懂
<?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 '=='.'<br>'; //true
if ($a === $b) echo '==='.'<br>'; //false
$str = serialize($a); //对象序列化成字符串
echo $str.'<br>';
$c = unserialize($str); //反序列化为对象
var_dump($c);