There are seven 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:
A few "magical" PHP constants Name Description
__LINE__ The current line number of the file. __FILE__ The full path and filename of the file. If used inside an include, the name of the included file is returned. __DIR__ The directory of the file. If used inside an include, the directory of the included file is returned. This is equivalent to dirname(__FILE__). __FUNCTION__ The function name. As of PHP 5 this constant returns the function name as it was declared (case-sensitive). __CLASS__ The class name. __METHOD__ The class method name. __NAMESPACE__ The name of the current namespace (case-sensitive). This constant is defined in compile-time
No comments:
Post a Comment