incorrect output from math

990 views php
4

I am trying to add this formula into my PHP script:

50x^(y?10)

In this example: x = 1.1 and y = 99 which makes the formula:

50*1.1^(99-10)

This should return ~241501.0278 as result. But when I apply this in PHP, I only get 110 as output.

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

What am I doing wrong here?

Reference: here

answered question

1 Answer

4

You are mis-interpreting the ^ symbol for the pow function.

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

^ is the Bitwise Exclusive Or operator.

posted this

Have an answer?

JD

Please login first before posting an answer.