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 trialEthan Thompson
1,081 PointsWhy is the editor not recognizing my conditional?
After looking through other student's code examples and mistakes, I believe I've confirmed that my conditional is correct. I think something is wrong with the editor because it keeps telling me to check both properties, which I'm already doing. Or maybe I've missed a small, but critical detail? Any help would be appreciated.
<?php
// add code below this comment
class Subdivision {
public $houses = array();
public function filterHouseColor($color) {
$output = array();
foreach ($this-houses as $house) {
if ($house->roof_color === $color || $house->wall_color === $color) {
$output[] = $house;
}
}
return $output;
}
}
?>
1 Answer
hossein forouzanfar
10,400 PointsHi, you are missing a greater than symbol in your foreach condition: $this-houses. it should be like $this->houses.
good luck coding ;)
Ethan Thompson
1,081 PointsEthan Thompson
1,081 PointsHa! I knew I probably missed something very basic. I guess I've been staring at my screen too long. Thanks, Hossein!