<?php class People { private $name; public function setName($name) { $this->name = $name; } public function getName() { return $this->name; } } $p1 = new People(); $p2 = new People(); echo '<pre>', var_dump($p1), var_dump($p2), '</pre>';
object(People)#1 (1) { ["name":"People":private]=> NULL } object(People)#2 (1) { ["name":"People":private]=> NULL }
$p1 = new People(); $p2 = $p1;
object(People)#1 (1) { ["name":"People":private]=> NULL } object(People)#1 (1) { ["name":"People":private]=> NULL }