1. Static
Static is corresponding to the normal member of the class that was previously made. The members of the class can be divided into two categories, one is ordinary members and the other is static members. The previous write amount is the ordinary member, the ordinary member belongs to the object. A static member belongs to a class, and static is relative to the ordinary member.
Definition of static Member:
// static//Ordinary members are objects belonging to//static members//static members are belong to the class//keyword: static//self keyword: class inside the class//In a static method cannot call ordinary members//ordinary method inside can call static members /* class fenbi{public $length;//The length of the chalk, defined as a normal member. public static $color;//The Color of the chalk, defined as a static member. Static defines the statically defined keyword. static function Show () { echo "Chalk color is:". Self:: $color;//self to the class name Fenbi can also, self in the class represents the class, this is the object inside the class. } function Xianshi () { echo "shows:". Self:: $color; }} $f = new Fenbi ();//Create an object $f->length;//use the object to call the ordinary member Fenbi:: $color = "Red";
Fenbi::show ();//Call static methods without Fenbi:: $color;//Because static members belong to classes, use the class name to call static members $f->xianshi (); */
10.25 pm Static