Predefined constants PHP comes ready-made with dozens of predefined constants that you generally will be unlikely to use as a beginner to PHP. However, there are a few—known as the magic constants—that you will find useful. The names of the magic constants always have two underscores at the beginning and two at the end, so that you won’t accidentally try to name one of your own constants with a name that is already taken. They are detailed in Table 3-5. The concepts referred to in the table will be introduced in future chapters. Table 3-5. PHP’s magic constants Magic constant __LINE__ __FILE__ Description The. | Predefined constants PHP comes ready-made with dozens of predefined constants that you generally will be unlikely to use as a beginner to PHP. However there are a few known as the magic constants that you will find useful. The names of the magic constants always have two underscores at the beginning and two at the end so that you won t accidentally try to name one of your own constants with a name that is already taken. They are detailed in Table 3-5. The concepts referred to in the table will be introduced in future chapters. Table 3-5. PHP s magic constants Magic constant 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. In versions ofPHP since FILE always contains an absolute path with symbolic links resolved whereas in older versions it might contain a relative path under some circumstances. __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 . This directory name does not have a trailing slash unless it is the root directory. Added in PHP . __FUNCTION__ The function name. Added in PHP . As of PHP 5 returns the function name as it was declared case-sensitive . In PHP 4 its value is always lowercase. __CLASS__ The class name. Added in PHP . As of PHP 5 returns the class name as it was declared casesensitive . In PHP 4 its value is always lowercased. __METHOD__ The class method name. Added in PHP . The method name is returned as it was declared case-sensitive . __NAMESPACE__ The name of the current namespace case-sensitive . This constant is defined at compile time. Added in PHP . One handy use of these variables is for debugging purposes when you need to insert a line of code to see whether the program flow reaches it echo This is line . _LINE__ . of file . __FILE__ This causes the current program line in the current