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 trialPhil Ward
4,204 PointsPHP Object task step 6 - the most frustrating challenge ever....
step 5 i appear to have finally got correct. the step appears to be just asking for the property to be assigned a new number 16661. When i do that it seems to look ok in the preview but task 5 then fails because the number has changed from 17?
aghhhhhhh!!!! this isn't even fully covered in the preceding videos!
<?php
include"class.palprimechecker.php";
$checker = new PalprimeChecker();
$checker->number = 17;
echo "The number " . $checker->number;
if($checker->isPalprime()) {
echo "is a palPrime";
} else {
echo "is not a palprime.";
}
?>
3 Answers
Brittany Kozura
17,143 PointsPhil - I know it has been a month since you asked, but it never really got answered, so here I am!
It is a very small error, and my guess is many make it.
As your post currently runs, it echos "The number 17is not a palprime." You need to add that extra space in at the end of the first echo statement, as shown:
<?php
include"class.palprimechecker.php";
$checker = new PalprimeChecker();
$checker->number = 17;
echo "The number " . $checker->number." ";
if($checker->isPalprime()) {
echo "is a palPrime";
} else {
echo "is not a palprime.";
}
?>
The instructions at the top specifically remind you to include this extra space.
Hope this helps!
Daniel- I believe your code had a similar issue.
Daniel Horowitz
Courses Plus Student 7,305 Points<?php
include"class.palprimechecker.php";
$checker = new PalprimeChecker();
$checker->number = 16661;
echo "The number " . $checker->number;
if($checker->isPalprime()) {
echo "is";
} else {
echo "is not";
}
echo " a palprime."
?>
Beyond frustrating.
Iain Simmons
Treehouse Moderator 32,305 PointsI believe it's failing because of the code you've changed where the echo statements are.
The exercise is looking for the exact text (with the spaces, and period at the end, lowercase palprime, etc):
The number 16661 is a palprime.
The previous exercises only asked you to change the first and then second echo statements, not to combine the last one with the second.
Fix up the first and second echo statements and you should be good to go.