This article mainly introduces the class static call in PHP and the scope of the difference operator, the need for friends can refer to, hope to help everyone.
The specific code looks like this:
<?php//calls this class or parent class with "::" Inside a subclass or class, instead of statically invoking the method, the scope resolution operator. Class ParentClass {public static $my _static = ' parent var '; function test () { self::who ();//output ' parent ' is a range resolution, not a static Call $this->who ();//output ' child ' static::who ();//delay static binding is a range resolution, not a static call} function who () { echo ' parent<br > '; }}class ChildClass extends ParentClass {public static $my _static = "Child var"; function who () { echo ' CHILD<BR&G t; '; }} $obj = new ChildClass (); $obj->test (); Echo ChildClass:: $my _static;//static Call
Above output
Parent
Child
Child
Child Var