Changes

Jump to: navigation, search

PHP Constants

1,445 bytes added, 14:57, 29 May 2007
Predefined PHP Constants
== Predefined PHP Constants ==
 
As we mentioned briefly at the start of this chapter, PHP provides a number of built-in constants that can be of significant use to the PHP web developer. In the section we will look at some of the more common constants available.
 
=== Script Related Constants ===
 
The following constants provide information about the script which currently being executed which are of particular use when debugging scripts:
 
<table border="1" cellspacing="0">
<th>Constant Name<th>Descrition</th>
<tr>
<td>__LINE__<td>Contains the number of the line in the current PHP file (or include file) which is being currently being executed by the PHP pre-processor.</td>
<tr>
<td>__FILE__<td>Contains the name of the file or include which contains the currently executing line of PHP code.</td>
<tr>
<td>__FUNCTION__<td>Contains the name of the PHP function which is currently executing</td>
<tr>
<td>__CLASS__<td>Contains the current which is currently in use</td>
<tr>
<td>__METHOD__<td>Contains the name of the method in the curerent class which is currently executing</td>
<tr>
<td>PHP_VERSION<td>Contains the version of PHP that is executing the script</td>
<tr>
<td>PHP_OS<td>Contains of the name of> OS hosting the PHP Pre-processor</td>
<tr>
<td>PHP_EOL<td>Contains the Newline chacter for the host OS (differs between UNIX/Linux and Windows for example)</td>
<tr>
<td>DEFAULT_INCLUDE_PATH<td>The default path where PHP looks for include files</td>
</table>

Navigation menu