<?php
interface I1{
// public function __construct(){
// echo "We cannot have constructors in interfaces";
// }
public function greet($name);
}
interface I2{
public function setter();
public function getter();
}
class Includer implements I1 , I2{
public function greet($name){
echo "Hello , $name. \n";
}
public function setter(){
echo "This is the setter method \n";
}
public function getter(){
echo "This is the getter method \n";
}
}
// $newObj = new I1(); This will throw error , that we cannot instantiate interface.
$ObjOne = new Includer();
$ObjOne->greet("Sudhir");
$ObjOne->setter();
$ObjOne->getter();
To embed this program on your website, copy the following code and paste it into your website's HTML: