課程
/后端開(kāi)發(fā)
/PHP
/PHP進(jìn)階篇
為什么過(guò)不了…
2014-06-20
源自:PHP進(jìn)階篇 2-4
正在回答
可以
<?php
class Car {
public $speed = 0;
//增加speedUp方法,使speed累加10
function speedUp() {
$this -> speed = ($this -> speed + 10);
$this -> speed += 10;
echo $this -> speed + 10;
echo '<br/>';
return $this -> speed + 10;
}
$car = new Car();
print_r($car->speedUp());
echo $car -> speedUp();
echo $car->speed;
$this -> speed += 10; 分號(hào)寫(xiě)錯(cuò)了!
舉報(bào)
輕松學(xué)習(xí)PHP中級(jí)課程,進(jìn)行全面了解,用PHP快速開(kāi)發(fā)網(wǎng)站程序
2 回答在這個(gè)平臺(tái)上可以顯示結(jié)果嗎?
1 回答為什么測(cè)試出來(lái)的matches[1]僅保留了子組的最后一個(gè)匹配呢?
2 回答$car ->speedUp(); 中->符號(hào)是什么意思
1 回答提交后提示錯(cuò)誤
1 回答我想訪問(wèn)我本地的一個(gè)文件的內(nèi)容,地址要怎么寫(xiě)?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢(xún)優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2014-08-06
可以
<?php
class Car {
public $speed = 0;
//增加speedUp方法,使speed累加10
function speedUp() {
$this -> speed = ($this -> speed + 10);
$this -> speed += 10;
echo $this -> speed + 10;
echo '<br/>';
return $this -> speed + 10;
}
}
$car = new Car();
print_r($car->speedUp());
echo '<br/>';
echo $car -> speedUp();
echo '<br/>';
echo $car->speed;
2014-06-26
$this -> speed += 10; 分號(hào)寫(xiě)錯(cuò)了!