Bird
0
0

Which keyword is used to declare that a class will follow an interface in PHP?

easy📝 Conceptual Q2 of 15
PHP - Interfaces and Traits
Which keyword is used to declare that a class will follow an interface in PHP?
Auses
Bextends
Cimplements
Dinherits
Step-by-Step Solution
Solution:
  1. Step 1: Recall PHP syntax for interfaces

    Classes use the keyword 'implements' to follow an interface.
  2. Step 2: Differentiate from 'extends'

    'extends' is for inheriting classes, not interfaces.
  3. Final Answer:

    implements -> Option C
  4. Quick Check:

    Interface usage keyword = implements [OK]
Quick Trick: Use 'implements' to link class to interface [OK]
Common Mistakes:
  • Using 'extends' instead of 'implements'
  • Using 'uses' which is invalid
  • Confusing inheritance with interface implementation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes