To get the value of Euler’s Constant e in php, the easiest way is to use the php constant **M_E**. **M_E** returns the value 2.718281828459.

`echo M_E; // 2.718281828459`

You can also use the php **exp()** function. exp(1) returns the value 2.718281828459.

`echo exp(1); // 2.718281828459`

In php, we can easily get the value of e for use in various equations and applications with the php predefined constants.

To get the value of the constant e in your php code, you just need to call the predefined constant **M_E**.

Below is an example of how to get Euler’s Constant in php using the predefined constant **M_E**.

`echo M_E; // 2.718281828459`

## Using the php exp() Function to Get Euler’s Constant e

In php, there are a number of great functions which allow us to do various calculations included in the built-in php math functions.

To get the value of the constant e in your php code, we can also call the **exp()** function and pass ‘1’ to it to raise the constant e to the first power.

Below is an example of how to get Euler’s Constant in php with the **exp()** function.

`echo exp(1); // 2.718281828459`

Hopefully this article has been helpful for you to understand how to get the value of e from the php constant **M_E** and **exp()** function.

## Leave a Reply