Can a class extend both a class and implement an Interface

前端 未结 3 1302
执念已碎
执念已碎 2021-01-30 06:06

Can a class extend both an interface and another class in PHP?
Basically I want to do this:

interface databaseInterface{
 public function query($q);
 public         


        
3条回答
  •  半阙折子戏
    2021-01-30 06:38

    yes, in fact if you want to implement multiple interfaces you can do like this:

    public class MyClass extends BaseClass implements myInterface1, myInterface2, myInterface3{ 
    
    }
    

提交回复
热议问题