数学能力在php中的公式中无法正常工作

问题描述 投票:0回答:1

我试图将此公式添加到我的PHP脚本中:

50x^(y−10)

在这个例子中:x = 1.1y = 99制作公式:

50*1.1^(99-10)

这应该返回~241501.0278作为结果。但是当我在PHP中应用它时,我只获得110作为输出。

$vocMultiplier = 1.1;
$startSkill = 99;
$amountOfHits = 50 * $vocMultiplier ^($startSkill - 10);
echo $amountOfHits;

我在这做错了什么?

参考:here

php math operators calc
1个回答
4
投票

你错误地解释了^符号的pow符号。

http://php.net/manual/en/function.pow.php

^是Bitwise Exclusive Or运算符。

© www.soinside.com 2019 - 2024. All rights reserved.