O'Reilly logo

PHP Quick Scripting Reference by Mikael Olsson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 14

image

Interface

An interface specifies methods that classes using the interface must implement. They are defined with the interface keyword followed by a name and a code block. Their naming convention is to start with a small “i” and then to have each word initially capitalized.

interface iMyInterface {}

Interface signatures

The code block for an interface can contain signatures for instance methods. These methods cannot have any implementations. Instead, their bodies are replaced by semicolons. Interface methods must always be public.

interface iMyInterface{  public function myMethod();}

Additionally, interfaces may define constants. These ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required