0
我想在两个字符(类)之间编写一个简单的PHP战斗。这是我的代码:
class Characters
{
public $hp = rand(int,int);
public $attack = rand(int,int);
};
class You extends Characters
{
$hp = rand(10,20); //this is line 11
$attack = rand(2,10);
};
$player = new You;
echo $hp;
但终端是抛出: '意外$马力的第11行(T_VARIABLE)在/home/szigeti/Desktop/sublime/Game/Gameboard/index.php'。
谢谢你这么多,如果 –
@DanielSzigeti答案帮助,请接受它。 – Script47