⊗ppOpIfNR 67 of 107 menu

Rules for Naming Interfaces in OOP in PHP

As already mentioned above, there cannot be an interface and a class with the same name. This creates some problems with coming up with names. For example, we want to create a class User that implements the User interface. As we can see, we have a name conflict. To resolve it, we need to either name the class differently, or the interface.

It is generally accepted in such cases to start the interface name with a lowercase letter i to show that it is an interface, not a class. That is, in our case, we will make the interface iUser, and it will be implemented by the class User. We will sometimes use this approach in the following lessons.

byenru