Search⌘ K

Challenge: Interfaces

Explore how to implement interfaces in PHP by creating a User class and Author and Editor interfaces. Learn to manage user privileges for authorship and editing within an AuthorEditor class. This lesson helps you apply object-oriented principles to handle multiple interfaces and print combined user privileges.

We'll cover the following...

Task

  • Create a User class with a protected $username property and methods that can set and get the $username.
  • Create an Author interface with two abstract methods that can give the user an array of authorship privileges. The first method is setAuthorPrivileges() with the parameter $array, and
...