# PHP exp() Function

## Definition and Usage

The exp() function calculates exponent of e that is Euler Number. PHP has a predefined constant M_E that represents Euler Number and is equal to 2.7182818284590452354. Hence, exp(x) returns 2.7182818284590452354x

This function always returns a float.

## Syntax

exp ( float \$arg ) : float

## Parameters

Sr.NoParameter & Description
1arg
a floating point number to raise e to

## Return Values

PHP exp() function returns the Euler Number e raised to given arg. Note that e is base of natural algorithm. The exp() function is inverse of natural logarithm.

Hence, if logex = y, then ey=x

## PHP Version

This function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.

## Example

Live Demo

One of the predefined constants in PHP is M_LN2 which stands for loge2 and is equal to 0.69314718055994530942. So exp() of this value will return 2 −

<?php
echo "exp(" . M_LN2 . ") = " . exp(M_LN2);
?>

## Output

This returns largest integer−

exp(0.69314718055995) = 2

## Example

Live Demo

M_LN10 is another predefined constant representing loge10. This program calculates exp(M_LN10) and returns 10 −

<?php
echo "exp(" . M_LN10 . ") = " . exp(M_LN10);
?>

## Output

This returns following output−

exp(2.302585092994) = 10

Updated on: 29-Jun-2020

61 Views