E¶
The letter e, or E, plays several distinct roles:
Floating number format:
eis used as part of a float literal to denote a power of 10.1.5e3means1.5 × 10³ = 1500, and7E-10means7 × 10⁻¹⁰. The letter is case-insensitive in this context. It is not an operator; it is part of the numeric syntaxExponential constant:
M_Eis a PHP predefined math constant equal to Euler’s numbere ≈ 2.718281828459045. It is the base of the natural logarithm, and satisfieslog(M_E) === 1. The functionexp(1)also returns this value, although floating-point rounding meansexp(1) === M_Emay evaluate tofalseEuler constant:
M_EULERis a distinct PHP constant, equal to the Euler constantγ ≈ 0.5772156649015329. It is also called Euler-Mascheroni, or gamma. It should not be confused withM_EError constant prefix: all PHP error level constants start with
E_:E_ERROR,E_WARNING,E_NOTICE,E_DEPRECATED,E_ALL, and others. They are used witherror_reporting()and combined with bitwise operatorsEscape sequence for escape character: in double-quoted strings and heredocs,
\eis the escape sequence for the ESC character, ASCII 27,0x1B. It is used in ANSI terminal escape codes.
<?php
// e in float scientific notation
$a = 1.5e3; // 1500.0
$b = 7E-10; // 0.0000000007
$c = 1e308; // close to PHP_FLOAT_MAX
// M_E : Euler's number
echo M_E; // 2.718281828459
echo exp(1); // 2.718281828459
echo log(M_E); // 1
// M_EULER : Euler-Mascheroni constant (different from M_E)
echo M_EULER; // 0.57721566490153
// E_ error level constants
error_reporting(E_ALL);
error_reporting(E_ERROR | E_WARNING);
// \e escape sequence : ESC character for ANSI terminal codes
echo "\e[31mRed text\e[0m\n";
?>
See also Math constants and Float syntax.
Related : Floating Point Numbers, Exponential, Logarithm, Not A Number (NAN), INF, Error Reporting, Escape Sequences, Exponent