Parse error: syntax error, unexpected '*'
This question already has an answer here:
Your syntax as it is, is correct. The problem is your PHP version. The **
operator was introduced in PHP 5.6 and you probably have something below.
So either update your PHP or use pow()
.
OP had an extra *
over
(1 + $rate / 100) ** $time)
which results into PHP syntax error Unexpected *
within PHP verison < 5.6.0 and works fine for the higher versions
function ci($principle, $rate, $time) {
$ci = ($principle * (((1 + $rate / 100) * $time) - 1));
//^^ removed extra *
echo $ci;
}
ci(10, 10, 10);
Demo
链接地址: http://www.djcxy.com/p/69470.html上一篇: PHP输入中的意外字符:'''(ASCII = 39)
下一篇: 解析错误:语法错误,意外的'*'