What is the difference between an Interface and an Abstract Class in PHP?
Last updated
An interface is a pure contract of method signatures (all implicitly public), and a class can implement many interfaces.
An abstract class is a partially implemented base that can hold concrete methods, properties, and constructors. It cannot be instantiated, and a class can extend only one.
Use an interface for a capability shared by unrelated classes. Use an abstract class to share real code among related subclasses ("is-a").
- https://en.wikipedia.org/wiki/PHP
- https://lemon.io/for-developers/php-developer-jobs/
- https://lan-portal.uob.edu.ly/visit/BOOK/529X432U02/modern-php_new__features_and_good-practices.pdf
- https://lan-portal.uob.edu.ly/upload/MD/D57953S372/modern-php__new_features_and__good__practices.pdf
- https://news.ycombinator.com/item?id=30786927
- https://kvnc-inc.medium.com/solid-principles-in-php-1c41069e9af6
- https://www.shkodenko.com/
- https://confoo.ca/en/2024/sessions