不知道错在哪里了
class Car { public $speed = 0; public function speedUp() { $this->speed += 10; } } $car = new Car(); $car->speedUp(); echo $car->speed;
上面是源代码,下面是自己在最后两行做的改动,不知道错在哪里
class Car { public $speed = 0; public function speedUp() { $this->speed += 10; } } $car = new Car(); echo $car->speedup();