[Solved] Why is the output Negative? [closed]


Many notations use “^” as a power operator, but in PHP (and other C-based languages) that is actually the XOR operator. You need to use this ‘pow’ function, there is no power operator.

In your code

$keone = $vone ^ 2;

Should be

$keone = pow($vone,2);

Rest of your code is fine. That pow function is the one you should use to raise your baise to the power given.

0

solved Why is the output Negative? [closed]