exp
Raises the number e to a power.
Syntax
exp(float $num): floatParameters
| Parameter | Type | Description |
|---|---|---|
| $num | float | The exponent. |
Return value
floate raised to the power of `$num`.
Examples
Continuous 5% growth of a deposit over 10 years:
<?php
echo round(exp(1), 4), "\n";
echo round(1000 * exp(0.05 * 10), 2);Output:
2.7183
1648.72Notes
The inverse function is the natural logarithm log().
See also
In the tutorial
- Numbers and maths — PHP's maths functions — rounding, number formatting, random numbers and the precision of fractions.