Encodera

Thanks for reading!

Donate to the site — we work hard for you.

PHP reference

exp

Raises the number e to a power.

Syntax

exp(float $num): float

Parameters

ParameterTypeDescription
$numfloatThe 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.72

Notes

The inverse function is the natural logarithm log().

See also

  • log — Calculates the logarithm of a number.
  • pow — Raises a number to a power.
  • pi — Returns the number pi.

In the tutorial

  • Numbers and maths — PHP's maths functions — rounding, number formatting, random numbers and the precision of fractions.

Thanks for reading!

Donate to the site — we work hard for you.