Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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
{}

2 Answers

Daniel Marin
Daniel Marin
8,021 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 :)

Charles Fields
Charles Fields
4,205 Points

I'm thinking the same as Daniel, but get this odd message that I should capitalize the "Students" interface. It's already capitalized and that part was already accepted in task 1 of the challenge. Here is my code. Does anyone understand what is meant by this error? <?php interface Students extends Countable { public function roster($class = null, $student = null); }

Charles Fields
Charles Fields
4,205 Points

Btw, how are people posting workspaces to this discussion? My code formatting went away when I posted the question above.