What are PHP Magic Constants

Post Reply
User avatar
Saman
Lieutenant Colonel
Lieutenant Colonel
Posts: 828
Joined: Fri Jul 31, 2009 10:32 pm
Location: Mount Lavinia

What are PHP Magic Constants

Post by Saman » Sun Jul 17, 2011 10:04 am

  1. __LINE__
    The current line number of the file.
  2. __FILE__
    The full path and filename of the file. If used inside an include, the name of the included file is returned. Since PHP 4.0.2, __FILE__ always contains an absolute path with symlinks resolved whereas in older versions it contained relative path under some circumstances.
  3. __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 5.3.0.)
  4. __FUNCTION__
    The function name. (Added in PHP 4.3.0) As of PHP 5 this constant returns the function name as it was declared (case-sensitive). In PHP 4 its value is always lowercased.
  5. __CLASS__
    The class name. (Added in PHP 4.3.0) As of PHP 5 this constant returns the class name as it was declared (case-sensitive). In PHP 4 its value is always lowercased.
  6. __METHOD__
    The class method name. (Added in PHP 5.0.0) The method name is returned as it was declared (case-sensitive).
  7. __NAMESPACE__
    The name of the current namespace (case-sensitive). This constant is defined in compile-time (Added in PHP 5.3.0).
User avatar
karnti4545
Posts: 1
Joined: Wed May 16, 2012 12:06 pm
Location: pune

Re: What are PHP Magic Constants

Post by karnti4545 » Wed May 16, 2012 12:12 pm

used jequry Library In php Constants but Normal used javascript.

Thank
Post Reply

Return to “PHP & MySQL”