PHP Interfaces
Interfaces (рдЗрдиреНрдЯрд░рдлреЗрд╕) рд▓реЗ class рд▓реЗ рдХреБрди methods implement рдЧрд░реНрдиреБрдкрд░реНрдЫ рднрдиреЗрд░ рддреЛрдХреНрди рдЕрдиреБрдорддрд┐ рджрд┐рдиреНрдЫред
Interfaces рд░ Abstract Classes рд▓рдЧрднрдЧ рдЙрд╕реНрддреИ рд╣реБрдиреНрдЫрдиреН, рддрд░ interfaces рдорд╛ рдХреЗрд╡рд▓ method signature рдорд╛рддреНрд░ рд╣реБрдиреНрдЫ, рдХреБрдиреИ рдкрдирд┐ method рдХреЛ body рд╣реБрдБрджреИрдиред
Intefaces рд▓рд╛рдИ interface keyword рдкреНрд░рдпреЛрдЧ рдЧрд░реЗрд░ define рдЧрд░рд┐рдиреНрдЫред
Example
<?php
interface Animal {
public function makeSound();
}
class Cat implements Animal {
public function makeSound() {
echo "Meow";
}
}
?>
interface Animal {
public function makeSound();
}
class Cat implements Animal {
public function makeSound() {
echo "Meow";
}
}
?>
Interface implement рдЧрд░реНрдирдХреЛ рд▓рд╛рдЧрд┐, class рдорд╛ implements keyword рдкреНрд░рдпреЛрдЧ рдЧрд░рд┐рдиреНрдЫред