exp(): The exponent of e

Calculate e raised to a power

exp() returns e raised to the supplied exponent. It is commonly used in exponential-growth and logarithmic calculations.

$value = exp(1);
echo $value; // approximately 2.718281828

exp() is especially useful for continuous growth/decay models and for calculations that are the inverse of the natural logarithm.

<?Php
echo exp(3);// Output is 20.085536923188
echo "<br>";
echo exp(-1);// Output is 0.36787944117144
echo "<br>";
echo exp(0);// Output is 1
echo "<br>";
?>
Syntax
float exp(float $num)

$num is the exponent. The return value is e raised to that power.


'e' is the base of the natural system of logarithms, its value is approximately 2.718282.

Example 1: Continuous compounding

<?php
$principal = 1000;
$rate = 0.08; // 8% continuously compounded rate
$time = 5;
$amount = $principal * exp($rate * $time);
echo round($amount, 2); // 1491.82
?>

Example 2: Exponential Decay

<?php
$initial_amount = 100;
$decay_constant = 0.03;
$time = 10;
$remaining_amount = $initial_amount * exp(-$decay_constant * $time);
echo "Remaining after 10 years: $remaining_amount";
?>

Example 3: Modeling Population Growth

<?php
$initial_population = 1000;
$growth_rate = 0.02;  // 2% annual growth
$years = 8;
$population = $initial_population * exp($growth_rate * $years);
echo "Population after 8 years: $population";
?>

Math Functions LOG() function


Subscribe to our YouTube Channel here



plus2net.com











PHP video Tutorials
✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer