Classes / Inheritance

<?php

interface IShape {
    public function getArea(): int;
}

class Square implements IShape {
    public $sideLength = 0;

    function __construct($sideLength) {
        $this->sideLength = $sideLength;
    }

    public function getArea(): int {
        return $this->sideLength * $this->sideLength;
    }
}

$square = new Square(5);
$area = $square->getArea();
//area is 25
echo $area;