代码在这里: $obj 是类用户的实例。我正在调用方法它没有显示输出
<?php
class user{
public $name;
public $age;
public function _ _construct($name, $age){
$this->name=$name;
$this->age=$age;
}
public function sayHello(){
echo("hiiiii".$this->name."!!!");
}
public function sayAge(){
$a=time()-strtotime($this->age);
echo " hello Your age is".floor($a/(365*30*60*60));
}
}
$obj = new user('xyz','16 july 1980');
$obj->sayHello();
$obj->sayAge();
?>