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

Challenge task 5 of 7 of Wrapping Up

Challenge task 5 of 7 PalprimeChecker objects have a method called isPalprime(). This method does not receive any arguments. It returns true if the number property contains a palprime, and it returns false if the number property does not contain a palprime. (Tip: 17 is not a palprime.) Turn the second echo statement into a conditional that displays “is” or “is not” appropriately. The conditional should call the isPalprime method of the $checker object. If the isPalprime method returns true, then echo “is”; otherwise, echo “is not”.

I got the error: "Bummer! It seems like you are calling the right method and you have the removed various placeholder characters (##|()), but something in the output is not quite right. Please double-check the preview."

My Code is here

<?php

require_once("class.palprimechecker.php");

$checker = new PalprimeChecker();

$checker->number = 17;

echo "The number ".$checker->number." ";

if ($checker->isPalprime()) echo "is";

else echo "is not";

// echo " a palprime.";

?> <input type="submit" value='Check My Work">

5 Answers

Have you tried refreshing the page or closing your browser and re-opening?

There isn't anything wrong with your code above except for the commented echo at the bottom.

I took your code above and pasted it into the challenge and removed that last comment. It went all the way through to task 6.

<?php
require_once("class.palprimechecker.php");

$checker = new PalprimeChecker();

$checker->number = 17;

echo "The number ".$checker->number." ";

if ($checker->isPalprime()) echo "is";

else echo "is not";

echo " a palprime.";

?>

If I leave the comment in the last echo statement then I get the error message you were getting. If I take it out then it passes.

I'm not sure what else to suggest other than restarting your browser or refreshing the page. That has helped other people who have the correct answer but it won't pass.

Hi Boj,

You have commented out your last echo statement. //echo " a palprime.";

Even I did not comment it, I still get the same error.

Maybe you need to refresh and try again.

I copied your code above and pasted it into the challenge. After un-commenting your last echo I was able to click all the way through to task 6.

I had submit several times. Still the same error appears.

I did all the things you recommended - refresh, resubmit, reboot computer. The error is still there.

Then try to remove the last following line which completed at the Task 1 of 7. <input type="submit" value=“Check My Work”>

Now, I passed the Task 5.

Confused it !! I should not do that because all the finished steps should be kept to end as the challenges recommend. Is it all right?

I'm not sure what happened to you. It could have been a problem the challenge was having.

In general you should be keeping all of your previous code as you complete each step.

You had all the correct code in your question except for the comment at the end. Your code had worked for me so I suspect the challenge was having some kind of problem when you were doing it. I know that a few people lately have been having problems with correct code not passing.