Home >Backend Development >PHP Tutorial >In-depth analysis of php interfaces and interface references_PHP tutorial
1. Introduction and creation of interfaces
Keywords: interface
2. References and specifications of interfaces
Keywords: implements
Interface : A special abstract class whose member attributes are all abstract, and have a standardized role in the program
1. All methods in the class are abstract
2. There is no need to add abstract before abstract methods
3. Interface abstraction The method attribute is public
4. The member attribute must be a constant
Abstract:
1. There is at least one abstract method in the class
2. Abstract must be added before the abstract method
Common points:
1. It cannot be instantiated, it must be inherited or referenced
2. After inheritance or reference, all abstract methods need to be overloaded before they can be used
Interface has its own creation keyword: interface is similar to the creation of ordinary classes