- var_dump: documentation ( source)
<?php
class Foo {
private $id;
public function __construct() {
$this->id = 1;
}
public function __toString() {
return $id . "";
}
public function setId($id) {
$this->id = $id;
}
}
$a = new Foo; // $a is a pointer pointing to Foo object 0
$b = $a; // $b is a pointer pointing to Foo object 0, however, $b is a copy of $a
$a->setId(5);
unset($b);
var_dump($b);