<?php class SimpleClass { // property declaration public $var = 'a default value'; // method declaration public function displayVar() { echo $this->var; } } $instance = new SimpleClass(); $assigned = $instance; $reference =& $instance; $assigned->var = "aaaaaaa"; $assigned = null; var_dump($instance); var_dump($reference); var_dump($assigned); /* 輸出內容: E:\php>php TestClass.php class SimpleClass#1 (1) { public $var => string(7) "aaaaaaa" } class SimpleClass#1 (1) { public $var => string(7) "aaaaaaa" } NULL 總結: $assigned, $reference, $assigned三個變量引用的都是同一塊內存地址, $assigned = null; 之後,斷開了指向$assigned的指針,所以$assigned為空,其他的變量不變 /