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 trialVaidas Jokubauskas
6,323 PointsHi. I have a problem with this challenge... I change the value of property, but I get "previous task is broken"...
Hi. I have a problem with this challenge... I change the value of property, but I get "previous task is broken"...
Vaidas Jokubauskas
6,323 PointsHi, Andrew. The code is:
<?php
include('class.palprimechecker.php');
$checker=new PalprimeChecker;
$number=$checker->number=17;
$number=$checker->number=16661;
echo "The number " . $number;
if($checker->isPalprime()->$number) {
echo "is";
} else {
echo "is not";
}
echo " a palprime.";
?>
Vaidas Jokubauskas
6,323 PointsI got response: "It looks like Task 5 is no longer passing."
2 Answers
Gareth Borcherds
9,372 PointsThe correct answer would be the following:
<?php
include('class.palprimechecker.php');
$checker=new PalprimeChecker;
$number=$checker->number=16661;
echo "The number ".$number;
if($checker->isPalprime($number)) {
echo "is";
} else {
echo "is not";
}
echo " a palprime.";
?>
Do you see where you went wrong in the if statement?
Vaidas Jokubauskas
6,323 PointsThank you, Gareth!
Andrew Showalter
14,028 PointsVaidas,
It looks like you chained methods together improperly. The code above from the mod shows it correctly where you chained a method but the last method ->$number should have been an argument to isPalprime()
Vaidas Jokubauskas
6,323 PointsThank you, Andrew, very much for your help!
Andrew Dushane
9,264 PointsAndrew Dushane
9,264 PointsCan you post the code you're entering?