我觉得我正在正确地看它,但是已经有一段时间了,而且还不能解决这个问题-尽管我知道答案将是一记耳光。我在);上遇到解析错误,无法弄清原因!

public function addchange($bchange, $tstep) {
        $nstate = $BodyModel->create5(
        $this->fat + $tstep * $bchange->df(),
        $this->lean + $tstep * $bchange->dl(),
        $this->glyc + $tstep * $bchange->dg(),
        $this->decw + $tstep * $bchange->dDecw(),
        $this->therm + $tstep * $bchange->dtherm(),
    ); // this is where im getting a parse error
    return $nstate;
}




JAVASCRIPT

    BodyModel.prototype.addchange = /*BodyModel*/ function(/*BodyChange*/ bchange, /*double*/ tstep)
{
    var nstate = BodyModel.create5(
        this.fat + tstep * bchange.df(),
        this.lean + tstep * bchange.dl(),
        this.glyc + tstep * bchange.dg(),
        this.decw + tstep * bchange.dDecw(),
        this.therm + tstep * bchange.dtherm()
    );
    return nstate;
}

最佳答案

删除passs参数中的结尾逗号。

public function addchange($bchange, $tstep) {
        $nstate = $BodyModel->create5(
        $this->fat + $tstep * $bchange->df(),
        $this->lean + $tstep * $bchange->dl(),
        $this->glyc + $tstep * $bchange->dg(),
        $this->decw + $tstep * $bchange->dDecw(),
        $this->therm + $tstep * $bchange->dtherm()
    );
    return $nstate;
}

07-24 15:29