<?php
interface Shape1
{
public function area();
}
interface Shape2
{
public function area();
}
class Rectangle implements Shape1, Shape2
{
private $width;
private $height;
public function __construct($width, $height)
{
$this->width = $width;
$this->height = $height;
}
public function area()
{
return $this->width * $this->height;
}
public function perimeter()
{
return ($this->width + $this->height) * 2;
}
}
$rectangle = new Rectangle(5, 20);
echo 'area: ' . $rectangle->area();
echo '<br>perimeter: ' . $rectangle->perimeter();
?>
area: 100
perimeter: 50