How is it possible to create a doubling function?
I have a start value 50
and I have an x
value of 3 as in the following example. I would like to get the following result:
y = 50 * 2 ^ 3 = 400.
But if I write the following code in PHP I get 1000000 as the result:
$y = pow(50 * 2 , 3);
How do I write this this power function properly in PHP?
This should work for you:
(You just wrote it in the wrong order)
echo $y = 50 * pow(2 , 3);
Output:
400
Your old code:
$y = pow(50 * 2 , 3); //Same as: $y = pow(100 , 3); and this means: 100 * 100 * 100