Home >>PHP Math Functions >PHP exp() Function

PHP exp() Function

PHP exp() Function

PHP exp() function is used to calculate e raised to the power of the given input power (ex). Here 'e' is the base of the natural system whose value is approximately 2.718282. It takes only a single parameter $power which defines the power e has to be raised to. It returns the value of e raised to the power of the given input argument.

Syntax:

  exp($power);

Parameter Values

Parameter Description
power This is a required parameter. This parameter defines the exponent.

Here is an example of exp() functionin PHP:

<html>
<body>

<?php

echo exp(0)."<br>";
echo exp(1)."<br>";

?>

</body>
</html>
Output:
1
2.718281828459

Here is an another example of exp() functionin PHP:

<html>
<body>

<?php

echo exp(2)."<br>";
echo exp(5)."<br>";
echo exp(15)."<br>";
echo exp(6.3)."<br>";
echo exp(20)."<br>";

?>

</body>
</html>
Output:
7.3890560989307
148.41315910258
3269017.3724721
544.57191012593
485165195.40979

No Sidebar ads