A Sample Interface : Interface « Class « PHP






A Sample Interface

 
<?php
     interface printable {
          public function printme();
     }

     class Integer implements printable {
          private $value;
          public function getValue() {
               return (int)$this->value;
          }
          public function printme() {
               echo (int)$this->value;
          }
     }
?>
  
  








Related examples in the same category

1.Implement an interface
2.Different class implements one interface
3.Implementing Multiple Interfaces
4.Defining an interface
5.Defining and Using an Interface
6.Using Type Hinting with Interfaces