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 Object-Oriented PHP Basics Building a Collection Collection Objects

Zdenek Krcal
Zdenek Krcal
49,910 Points

Hello, I have problem with Task Challenge in PHP.

My code is:

<?php
class Subdivision
{
  public $houses;

  public function filterHouseColor($color)
  {
    $ar = array();
    foreach($houses as $house)
    {
      if($house->roof_color == $color || $house->wall_color == $color)
      {
        $ar[] = $house->lot;
      }
    }

    return $ar;
  }
}


?>

1 Answer

Hi, Zdenek, I gave an answer to a question related to this challenge in another thread. Have a look there, and it might help you with your doubts.

https://teamtreehouse.com/community/the-last-objectoriented-php-basics-code-challenge