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 trialReese Thompson
13,676 PointsCant seem to figure this one out
So I can't quite seem to figure this one out, code below:
<?php include("class.palprimechecker.php"); $checker = new PalprimeChecker; $checker->number = 17;
echo "The number " . $checker->number; if ($checker->isPalprime() == true) {echo " is"} else {echo " is not"}; echo " a palprime.";
?>
I know $checker->isPalprime() should return a boolean anyway, but I've tried it both ways now (and a few more) with and without the == true.
1 Answer
Gareth Borcherds
9,372 PointsYour semi colon for the if statement is in the wrong place. It should look like this
If($checker->isPalprime()) {
echo 'is';
} else {
echo 'is not';
}
Notice there is a semi colon after each echo statement. You have to finish each echo statement with that semi colon before continuing. It should also be noted that I didn't use == true, but that works too. You just need to fix the semi colon placement.
Reese Thompson
13,676 PointsReese Thompson
13,676 PointsThank you so much, don't know how I missed that so many times. Really appreciate the help though.