How to Calculates the exponent of e in PHP ?
In PHP, we can calculate the exponent of e using the exp()
function. The exp()
function returns the value of e raised to the power of a given number.
Syntax:
exp(number)
Example:
$num = 2;
$exp = exp($num);
echo "Exponent of e raised to the power of $num is: $exp";
Output:
Exponent of e raised to the power of 2 is: 7.3890560989307
Another method to calculate the exponent of e is by using the pow()
function. We can use the M_E
constant in PHP to represent the value of e.
Syntax:
pow(M_E, number)
Example:
$num = 3;
$exp = pow(M_E, $num);
echo "Exponent of e raised to the power of $num is: $exp";
Output:
Exponent of e raised to the power of 3 is: 20.085536923188