EXP Function in PHP



The exp() function Returns ex. This is e raised to the power x.

Here,

'e' is 2.718282
x is the power

Syntax

exp(x)

Parameters

  • x = The exponent

Return

The exp() function Returns e raised to the power of x, which is a float value.

Example

 Live Demo

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

Output

1<br>2.718281828459

Let us see another example −

Example

 Live Demo

<?php
   echo(exp(2) . "<br>");
   echo(exp(5) . "<br>");
   echo(exp(20));
?>

Output

7.3890560989307<br>148.41315910258<br>485165195.40979
Updated on: 2020-06-26T09:48:06+05:30

78 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements