Top Ad unit 728 × 90

ticker

PHP Magic Constants

PHP Magic Constants

PHP provides a large number of predefined constants to any script which it runs.


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:


A few "magical" PHP constants ate given below:


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 turned.Since

PHP 4.0.2, __FILE__ always contains an absolute path whereas in older versions it contained relative path under some circumstances.


__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.


__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.


__METHOD__

The class method name. (Added in PHP 5.0.0) The method name is returned as it was declared (case-sensitive).


PHP Magic Constants Reviewed by Rajat Jha on 20:18:00 Rating: 5

No comments:

All Rights Reserved by INFO PHP 99 © 2014 - 2015
Powered by Blogger, Designed by Sweetheme

Contact Form

Name

Email *

Message *

Powered by Blogger.