<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
</head>
<body>
<?php
class Person{
public function __construct($iname,$isex,$iage){
$this->name=$iname;
$this->sex=$isex;
$this->age=$iage;
}
public function showInfo(){
echo $this->name." ".$this->sex." ".$this->age."<br/>";
}
public $name;
public $sex;
public $age;
}
$person=new Person("张三","woman",18);
$person->showInfo();
?>
</body>
</html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
</head>
<body>
<?php
class Person{
public function __construct($iname,$isex,$iage){
$this->name=$iname;
$this->sex=$isex;
$this->age=$iage;
}
public function showInfo(){
echo $this->name." ".$this->sex." ".$this->age."<br/>";
}
public function __destruct(){
echo "析构函数<br/>";
}
public $name;
public $sex;
public $age;
}
$person1=new Person("张三","woman",18);
$person1=NULL;
$person2=new Person("李四","man",19);
$person2->showInfo();
?>
</body>
</html>