exp(): The exponent of e

<?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
exp(X);
X is the input float . We get output as e raised to the power of X
'e' is the base of the natural system of logarithms, its value is approximately 2.718282.

Example 1: Calculating Compound Interest

<?php
$principal = 1000;
$rate = 0.08; // 8% 
$time = 5;
$amount = $principal * exp($rate * $time);
echo "Amount after 5 years: $amount";  // Output: Amount after 5 years
?>

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
Subhendu Mohapatra — author at plus2net
Subhendu Mohapatra

Author

🎥 Join me live on YouTube

Passionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.



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-2025   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer