Predefined constants

PHP provides a large number of predefined constants to any script which it runs. Many of these constants, however, are created by various extensions, and will only be present when those extensions are available, either via dynamic loading or because they have been compiled in.

There are five magical constants that change depending on where they are used. For example, the value of __LINE__ depends on the line that it's used on in your script. These special constants are case-insensitive and are as follows:

Table 8-1. A few "magical" PHP constants

NameDescription
__LINE__ The current line number of the file.
__FILE__ The full path and filename of the file.
__FUNCTION__ The function name. (This was added in PHP 4.3.0.)
__CLASS__ The class name. (This was added in PHP 4.3.0.)
__METHOD__ The class method name. (This was added in PHP 5.0.0)

A list of predefined constants is available in the reserved predefined constants section.


Sites of interest: Web Hosting : Reseller Hosting : Website Hosting : HTML Editor : Web Design Templates : Free Web Hosting : ASP code examples : PHP & MySQL Code Examples
  Copyright © 2004 Evrsoft Developer Network. Privacy policy - Link to Us

Contact Evrsoft