<?phpclass MyPc { var $hpf; public $name; /*function MyPc ($name='') { $this->name=$name; }*/ function __construct($name=''){ $this->name=$name; } function newfu(){ echo "this is ok!"; } function game () { return $this->name."play games!
"; } function compute () { return "编程!"; } function __destruct(){ echo "
------------------------".$this->name; }}$pc1=new MyPc("家用电脑");$pc2=new MyPc("公司电脑");$pc3=new MyPc("");echo $pc1->game();$pc1=null;echo "
".$pc2->name;?>