<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Predefined Constants</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="math.resources.html">Resource Types</a></div> <div class="next" style="text-align: right; float: right;"><a href="ref.math.html">Math Functions</a></div> <div class="up"><a href="book.math.html">Math</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="math.constants" class="appendix"> <h1>Predefined Constants</h1> <p class="simpara"> The constants below are always available as part of the PHP core. </p> <p class="para"> <table class="doctable table"> <caption><strong>Math constants</strong></caption> <thead> <tr> <th>Constant</th> <th>Value</th> <th>Description</th> <th>Availability</th> </tr> </thead> <tbody class="tbody"> <tr id="constant.m-pi"> <td><strong><code>M_PI</code></strong></td> <td>3.14159265358979323846</td> <td>Pi</td> <td class="empty"> </td> </tr> <tr id="constant.m-e"> <td><strong><code>M_E</code></strong></td> <td>2.7182818284590452354</td> <td>e</td> <td class="empty"> </td> </tr> <tr id="constant.m-log2e"> <td><strong><code>M_LOG2E</code></strong></td> <td>1.4426950408889634074</td> <td>log_2 e</td> <td class="empty"> </td> </tr> <tr id="constant.m-log10e"> <td><strong><code>M_LOG10E</code></strong></td> <td>0.43429448190325182765</td> <td>log_10 e</td> <td class="empty"> </td> </tr> <tr id="constant.m-ln2"> <td><strong><code>M_LN2</code></strong></td> <td>0.69314718055994530942</td> <td>log_e 2</td> <td class="empty"> </td> </tr> <tr id="constant.m-ln10"> <td><strong><code>M_LN10</code></strong></td> <td>2.30258509299404568402</td> <td>log_e 10</td> <td class="empty"> </td> </tr> <tr id="constant.m-pi-2"> <td><strong><code>M_PI_2</code></strong></td> <td>1.57079632679489661923</td> <td>pi/2</td> <td class="empty"> </td> </tr> <tr id="constant.m-pi-4"> <td><strong><code>M_PI_4</code></strong></td> <td>0.78539816339744830962</td> <td>pi/4</td> <td class="empty"> </td> </tr> <tr id="constant.m-1-pi"> <td><strong><code>M_1_PI</code></strong></td> <td>0.31830988618379067154</td> <td>1/pi</td> <td class="empty"> </td> </tr> <tr id="constant.m-2-pi"> <td><strong><code>M_2_PI</code></strong></td> <td>0.63661977236758134308</td> <td>2/pi</td> <td class="empty"> </td> </tr> <tr id="constant.m-sqrtpi"> <td><strong><code>M_SQRTPI</code></strong></td> <td>1.77245385090551602729</td> <td>sqrt(pi)</td> <td>PHP 5.2.0</td> </tr> <tr id="constant.m-2-sqrtpi"> <td><strong><code>M_2_SQRTPI</code></strong></td> <td>1.12837916709551257390</td> <td>2/sqrt(pi)</td> <td class="empty"> </td> </tr> <tr id="constant.m-sqrt2"> <td><strong><code>M_SQRT2</code></strong></td> <td>1.41421356237309504880</td> <td>sqrt(2)</td> <td class="empty"> </td> </tr> <tr id="constant.m-sqrt3"> <td><strong><code>M_SQRT3</code></strong></td> <td>1.73205080756887729352</td> <td>sqrt(3)</td> <td>PHP 5.2.0</td> </tr> <tr id="constant.m-sqrt1-2"> <td><strong><code>M_SQRT1_2</code></strong></td> <td>0.70710678118654752440</td> <td>1/sqrt(2)</td> <td class="empty"> </td> </tr> <tr id="constant.m-lnpi"> <td><strong><code>M_LNPI</code></strong></td> <td>1.14472988584940017414</td> <td>log_e(pi)</td> <td>PHP 5.2.0</td> </tr> <tr id="constant.m-euler"> <td><strong><code>M_EULER</code></strong></td> <td>0.57721566490153286061</td> <td>Euler constant</td> <td>PHP 5.2.0</td> </tr> <tr id="constant.php-round-half-up"> <td><strong><code>PHP_ROUND_HALF_UP</code></strong></td> <td>1</td> <td>Round halves up</td> <td>PHP 5.3.0</td> </tr> <tr id="constant.php-round-half-down"> <td><strong><code>PHP_ROUND_HALF_DOWN</code></strong></td> <td>2</td> <td>Round halves down</td> <td>PHP 5.3.0</td> </tr> <tr id="constant.php-round-half-even"> <td><strong><code>PHP_ROUND_HALF_EVEN</code></strong></td> <td>3</td> <td>Round halves to even numbers</td> <td>PHP 5.3.0</td> </tr> <tr id="constant.php-round-half-odd"> <td><strong><code>PHP_ROUND_HALF_ODD</code></strong></td> <td>4</td> <td>Round halves to odd numbers</td> <td>PHP 5.3.0</td> </tr> <tr id="constant.nan"> <td><strong><code>NAN</code></strong></td> <td>NAN (as a float)</td> <td>Not A Number</td> <td class="empty"> </td> </tr> <tr id="constant.inf"> <td><strong><code>INF</code></strong></td> <td>INF (as a float)</td> <td>The infinite</td> <td class="empty"> </td> </tr> </tbody> </table> </p> <p class="para"> All constants without a labeled PHP version above are available starting with PHP 4.0.0. </p> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="math.resources.html">Resource Types</a></div> <div class="next" style="text-align: right; float: right;"><a href="ref.math.html">Math Functions</a></div> <div class="up"><a href="book.math.html">Math</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>