PHP exp() Function
In this chapter you will learn:
- Definition for PHP exp() Function
- Syntax for PHP exp() Function
- Parameter for PHP exp() Function
- Return for PHP exp() Function
- Example - Return 'e' raised to the power of different numbers
Definition
The exp() function returns e raised to the power of x (ex).
'e' is the base of the natural system of logarithms (approximately 2.718282) and x is the number passed to it.
Syntax
PHP exp() Function has the following syntax.
exp(num);
Parameter
Parameter | Description |
---|---|
num | Required. Specifies the exponent |
Return
Item | Description |
---|---|
Return Value | 'e' raised to the power of x |
Return Type | Float |
Example
Return 'e' raised to the power of different numbers:
<?php//java 2 s. c om
echo(exp(0) . "\n");
echo(exp(1) . "\n");
echo(exp(10) . "\n");
echo(exp(4.8));
?>
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP expm1() Function
- Syntax for PHP expm1() Function
- Parameter for PHP expm1() Function
- Return for PHP expm1() Function
- Example - 'e' raised to the power of x minus 1
Home » PHP Tutorial » PHP Math Functions