Declaring a class property or method as static can be accessed directly without instantiating the class. Static properties cannot be accessed through an object that a class has instantiated (but static methods can).
PHP 5 supports abstract classes and abstract methods. A class that is defined as abstract cannot be instantiated
Using interfaces (interface), you can specify which methods a class must implement, but you do not need to define the specifics of these methods.
The __tostring () method is used to respond to a class when it is treated as a string.
The __invoke () method is called automatically when an attempt is made to invoke an object in a way that invokes a function .
The use of late static bindings?
Class A {
public static function foo () {
Static::who ();
}
public static function who () {
echo __class__. " \ n ";
}
}
Class B extends A {
public static function test () {
A::foo (); This is the field represented by the class name, and the latter two are expressed in relation to the parent self. Visible, the class name can be used to control the domain, and the relative domain is all later bound.
Parent::foo ();
Self::foo ();
}
public static function who () {
echo __class__. " \ n ";
}
}
Class C extends B {
public static function who () {
echo __class__. " \ n ";
}
}
C::test ();