Facebook Page Twitter Page LinkedIn Page
× PHP Tutorial PHP Advanced PHP Resources


The PHP Math exp() function returns e raised to the power of specified number (ex). Please note that e is the base of the natural system of logarithms, and its value is approximately 2.718282.

Syntax

exp(x)

Parameters

number Required. Specify the exponent of e.

Return Value

Returns e raised to the power of specified number.

Example:

In the below example, exp() function is used to calculate e raised to the power of specified number.

<?php
echo exp(2)."\n";
echo exp(-2)."\n";  
echo exp(1.5)."\n";
echo exp(-1.5)."\n";
?>

The output of the above code will be:

7.3890560989307
0.13533528323661
4.4816890703381
0.22313016014843

❮ PHP Math Functions