Hasan Setiawan

Write, write, write give your wings on code!

Follow me on GitHub

Interface Dependency in PHP

Interface Dependency

An interface can also extend another interface which allow us to define dependencies.

              
                interface A {
                  public function do1();
                  public function do2();
                }

                interface B extends A { // you could extends function from another interface
                  public function do1();
                  public function do3();
                }

                class C implements B {

                  public function do1() {
                    // you could define your custom behavior here
                  }

                  public function do2() {
                    // you could define your custom behavior here
                  }

                  public function do3() {
                    // you could define your custom behavior here
                  }
                }