类方法里面加10为啥用+=10
<?php
class Car {
public $speed = 0;
//增加speedUp方法,使speed加10
public function
speedUp() {
$this->speed+=10;
}
}
$car = new Car();
$car->speedUp();
echo $car->speed;
<?php
class Car {
public $speed = 0;
//增加speedUp方法,使speed加10
public function
speedUp() {
$this->speed+=10;
}
}
$car = new Car();
$car->speedUp();
echo $car->speed;
2017-03-21
举报