Is multiple inheritance supported in PHP?

  • Yes
  • No
  • It depends on the PHP version being used
  • Multiple inheritance is not supported, but interfaces can be used to achieve similar functionality
No, multiple inheritance is not supported in PHP. PHP only supports single inheritance, which means a class can inherit from only one parent class. However, PHP does support interfaces, which can be used to achieve similar functionality as multiple inheritance by implementing multiple interfaces in a class. Interfaces define a contract that a class must adhere to, allowing for code reusability and achieving a form of multiple inheritance through interface implementation.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *