How to implement delayed static binding in php
Editor to share with you how to achieve delayed static binding php, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
The specific analysis is as follows:
Php delayed static binding: refers to the self of the class, not based on the time of definition, but on the result of the run at the time of calculation. Let's look at an example first.
Description:
(1) when the subclass instantiates the object $stu to call the say method, it runs within the parent class Human, so the self::hei () in say () calls the parent class's hei () method.
(2) static:: method name (): if you use the static keyword, first look for the method in the subclass; if you can't find it, look in the parent class.
These are all the contents of the article "how to achieve delayed static binding in php". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!