Assuming the Horse class exists, which is a valid example of inheritance in PHP?

✅  The correct answer is:

class Pegasus extends Horse {}

Question:

Assuming the Horse class exists, which is a valid example of inheritance in PHP?

Solution:

  • class Pegasus extends Horse {}
  • class Alicorn imports Pegasus, Unicorn {}
  • class Unicorn implements Horse {}
  • class Horse inherits Unicorn {}