<?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
<?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
?>
<?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";
?>
<?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";
?>
Author
🎥 Join me live on YouTubePassionate 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.