Friends, repeatedly wondered and asked a question here, worried and haunted the thought about why we need interfaces in php for example.
There are heaps of examples where only that they explain are given a hard-typed structure for other classes that implement and are required to implement public methods, but the point is really only in this, surfing the articles on the interfaces were such opinions that they allow to bypass non-multiple inheritance, That is, as? Explain, please, an elementary example of communication, how does this happen?
Let's say there is an interface with one method. The classes that implement it implement it to fit their needs as they would like, but everywhere in different ways, is that all? Suppose we inherit from the class that implemented the interface, then what?
Update
<?php interface lol { public function game(); } class outlol implements lol { public function game() { return "outlol"; } } class inlol implements lol { public function game() { return "inlol"; } } class anon { public function you(inlol $inlol) { echo $inlol->game(); } public function to(outlol $outlol) { echo $outlol->game(); } } $obj = new anon(); $obj->you(new inlol()); echo "<br />"; $obj->to(new outlol()); echo "<br />"; Will return the appropriate lines, this is an example of the implementation of interfaces?