Interfaces and Instanceof in OOP in PHP

Using instanceof, you can check whether a certain class implements a given interface or not. Let's look at an example. Suppose we have the following class:

Quadrate.php<?php
  class Quadrate implements iFigure
  {
    
  }
?>

Let's create an object of this class and check it with the instanceof operator:

index.php<?php
  $quadrate = new Quadrate;
  
  var_dump($quadrate instanceof Quadrate); // will output true
  var_dump($quadrate instanceof Figure);   // will output true
?>
Задание 1

Create an interface Figure3d (three-dimensional figure), which will have the method getVolume (get volume) and the method getSurfaceSquare (get surface area).

Задание 2

Create a class Cube that will implement the interface Figure3d.

Задание 3

Create several objects of the class Quadrate, several objects of the class Rectangle and several objects of the class Cube. Write them into the array $arr in random order.

Задание 4

Loop through the array $arr and output to the screen only the areas of objects implementing the interface iFigure.

Задание 5

Loop through the array $arr and output the areas for flat figures, and for three-dimensional ones - their surface areas.