Whats an interface ^^?
I’m assuming you’re referring to interfaces as described in the first link below. That is quite a useful link. You are vaguely right but not quite. It’s quite a complex subject to try to describe in a few words but there are many advantages to using interfaces. I’d suggest you read a bit more about Object oriented programming including inheritance and polymorphism. It’s also useful to read about the “dependency inversion principle” where we use interfaces to reduce the coupling between classes. The article in the second link below, although written about C++, is still applicable to PHP and gives an idea of how we can make software designs more flexible and extensible by using interfaces (note that C++ doesn’t have the “interface” keyword; in C++ interfaces are defined using an abstract class i.e., one with only pure virtual functions. In simple terms though, an interface provides the specification of how one class (let’s say the client) interacts with another ‘class’ (let’s say the ser