<?php
interface Animals{
public function speak();
}
class Dog implements Animals{
public function speak(){
return "The Dog Barks";
}
}
class Cat implements Animals{
public function speak(){
return "The Cat Meows";
}
}
class Bird implements Animals{
public function speak(){
return "The Bird Chirps";
}
}
$animals = [new Dog(), new Cat(), new Bird()];
foreach ($animals as $animal) {
echo $animal->speak();
}