Home > Article > Backend Development > PHP object-oriented static late binding static::
The content of this article is about PHP object-oriented static delayed binding static::, which has a certain reference value. Now I share it with you. Friends in need can refer to it.
self represents the current class , static:: represents the last executed class (also known as static delayed binding)
Above code:
<?php class School{ const COUNT = 56; public function showInfo(){ echo self::COUNT; echo '<br/>' . static::COUNT; //static::代表最后执行类,self代表当前类,parent代表父类 } } class University extends School{ const COUNT = 10000; } $school = new University; $school -> showInfo();
Related recommendations:
The three basic characteristics and five basic principles of object-oriented PHP
The above is the detailed content of PHP object-oriented static late binding static::. For more information, please follow other related articles on the PHP Chinese website!