PHP Designing Interfaces in PHP Using Interfaces Defining Interfaces

Add an abstract method named "roster" that accepts 2 optional parameters.

Add an abstract method named "roster" that accepts 2 optional parameters.

Students.php
<?php
interface Students extends Countable
{}

1 Answer

Daniel Marin
Daniel Marin
8,019 Points

Hi, So abstract methods don't contain a body and optional params means these params already have a value defined in the method. So something like this:

<?php

interface Students extends Countable {
  public function roster($foo = null, $bar = null);
}

thanx again Daniel Marin :)