复制代码 代码如下:
<?php
class SimpleClass{
public $var = 'a default value';
public function displayVar() {
echo $this->var;
}
}
$instance = new SimpleClass();
$assigned = $instance;
$reference =& $instance;
$instance->var = '$assigned will have this value';
$instance = null; // $instance and $reference become null var_dump($instance);var_dump($reference);var_dump($assigned);
var_dump($instance);
var_dump($assigned);
var_dump($reference);
?>
新闻热点
疑难解答