level 1
xcmd5201
楼主
这段代码,老是报第九行错,麻烦指点一下
<?php
class SO{
public $name;
public $height;
public $tizhong;
public $age;
public $sex;
public function__construct($name,$height,$tizhong,$age,$sex){
$this->name=$name;
$this->height=$height;
$this->tizhong=$tizhong;
$this->age=$age;
$this->sex=$sex;
}
public function bFB(){
if($this->height<185 and $this->tizhong<85){
return $this->name."能踢足球";
}else{
return $this->name."不能踢足球";
}}
}
$sport = new SO('小明',186,86,20,'男');
echo $sport->bFB()
?>
2021年08月27日 11点08分
1
<?php
class SO{
public $name;
public $height;
public $tizhong;
public $age;
public $sex;
public function__construct($name,$height,$tizhong,$age,$sex){
$this->name=$name;
$this->height=$height;
$this->tizhong=$tizhong;
$this->age=$age;
$this->sex=$sex;
}
public function bFB(){
if($this->height<185 and $this->tizhong<85){
return $this->name."能踢足球";
}else{
return $this->name."不能踢足球";
}}
}
$sport = new SO('小明',186,86,20,'男');
echo $sport->bFB()
?>