This site uses cookies from Google to deliver its services, to personalize ads and to analyze traffic. Information about your use of this site is shared with Google. By using this site, you agree to its use of cookies. Learn More

Magic Methods-php

Magic Methods-php SEM,SEO Magic Methods-php





Magic Methods and Constants
Magicmethods are specially named methods that
can be defi nedin any class and are executed via
builtin PHP functionality.
Magic methods always begin with a double
underscore. In fact, the magic methods __destruct() and __construct() have already been used several times.

It is often useful to determine where in the code output originates.

This is the purpose of all of the magic constants and is particularlyuseful when writing custom logging functions.

The seven magic constants are as follows:
__CLASS__ equates to the class in which the constant is referenced.

As noted earlier, this variable is always equal to the class in which it is defi ned, which is not always the class that was instantiated.

For example, __CLASS__ as defi ned inside Node always returns Node even if the method is part of an object that was instantiated as a descendant class.
In addition to debugging, the class constant is also useful for static callback functions.
__FILE__ is always equal to the file name where the constant is referenced.
__LINE__ is used in conjunction with __FILE__ in order to output a location in code.

0 Response to "Magic Methods-php"

Posting Komentar

Contact

Nama

Email *

Pesan *