PHP Predefined Math Constants

Definition

The following table lists the useful predefined math constants.

ConstantValueDescription
INFINFThe infinite
M_E2.7182818284590452354 e
M_EULER0.57721566490153286061 Euler constant
M_LNPI1.14472988584940017414 the natural logarithm of PI: log_e(pi)
M_LN20.69314718055994530942 the natural logarithm of 2: log_e 2
M_LN102.30258509299404568402 the natural logarithm of 10: log_e 10
M_LOG2E1.4426950408889634074 the base-2 logarithm of E: log_2 e
M_LOG10E0.43429448190325182765 the base-10 logarithm of E: log_10 e
M_PI3.14159265358979323846 Pi
M_PI_21.57079632679489661923 Pi/2
M_PI_40.78539816339744830962 Pi/4
M_1_PI0.31830988618379067154 1/Pi
M_2_PI0.63661977236758134308 2/Pi
M_SQRTPI1.77245385090551602729 the square root of PI: sqrt(pi)
M_2_SQRTPI1.12837916709551257390 2/square root of PI: 2/sqrt(pi)
M_SQRT1_20.70710678118654752440 the square root of 1/2: 1/sqrt(2)
M_SQRT21.41421356237309504880 the square root of 2: sqrt(2)
M_SQRT31.73205080756887729352 the square root of 3: sqrt(3)
NAN NANNot A Number
PHP_ROUND_HALF_UP1Round halves up
PHP_ROUND_HALF_DOWN2Round halves down
PHP_ROUND_HALF_EVEN3Round halves to even numbers
PHP_ROUND_HALF_ODD4Round halves to odd numbers




















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions