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
Tony McCabe
8,445 PointsObjects 7 of 7
So, it looks like 16661 is a palprime. Test out your code with these new numbers you have unlocked: 151, 1881, or 12421. There is nothing new to code for this task; just set the number property to one of these values and finish.<?php
include_once ("class.palprimechecker.php"); $checker = new palprimechecker ;
$checker -> number = 151,1881,12421; $palprime_number = $checker->number;
$palprime_status = ( $checker->isPalprime() ? "is" : "is not");
echo "The number $palprime_number $palprime_status a palprime.";
4 Answers
Randy Hoyt
Treehouse Guest TeacherHmmm ... congrats on figuring out a way to make this code challenge work, but I meant for you to use an if statement with an else block.
if ($checker->isPalprime()) {
echo "is";
} else {
echo "is not";
}
That's the technique I covered in the video.
For the last task, you need to set the number property equal to only one of those numbers — not all three:
$checker->number = 151;
Martina Carrington
Courses Plus Student 15,807 Pointsi am having problem with task 7 of 7 <?php
include_once ("class.palprimechecker.php"); $checker = new palprimechecker ;
$checker -> number = 151,1881,12421; $palprime_number = $checker->number;
$palprime_status = ( $checker->isPalprime() ? "is" : "is not");
echo "The number $palprime_number $palprime_status a palprime."; if ($checker->isPalprime()) { echo "is"; } else { echo "is not"; } ?>
Martina Carrington
Courses Plus Student 15,807 PointsI have try several times and i still get a bumper ? i do need help on stage 7
MUZ140575 Olisa Magaso
5,658 Pointsok i were the problem is you are using all 3 numbers instead the question requires you to check the code using only one of the numbers
$checker->number=151;
just like we were shown by randy in his example