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 Build a Simple PHP Application Wrapping Up The Project Objects

Cant 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
Gareth Borcherds
9,372 Points

Your 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.

Thank you so much, don't know how I missed that so many times. Really appreciate the help though.