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

Sanoop R
Sanoop R
6,015 Points

Cant get past challenge 6 ,Build a Simple PHP Application Wrapping Up The Project code challenge objects

when i change $checker number property to to 16661 it says task 5 no longer exist .. my code is

<?php
 include("class.palprimechecker.php");
$checker=new PalprimeChecker;
$checker->number=16661;
echo "The number ".$checker->number;
if($checker->isPalprime())
{
echo "is palprime";
}else{
echo "is not a palprime.";
 }
 ?>
Long Truong
Long Truong
5,432 Points

to past part 5 of this code challenge the code should look like this. <?php include("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."; ?>

to past part 6 the code should look like this

<?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."; ?>

Long Truong
Long Truong
5,432 Points

sorry about the messy layout, I'm new to this and not sure how to put it in a nicer order like yours xD.

Sanoop R
Sanoop R
6,015 Points

When i change that then the code challenge says task 5 is no loonger passing....

3 Answers

Long Truong
Long Truong
5,432 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."; ?>

Long Truong
Long Truong
5,432 Points

Did you get it to work? I also got the same message that 5 was no longer passing, I just pressed the go back to work on 5 and when I got it to pass I was able to then change 17 to 16661 and part 6 passed and this was the code I ended up with.

Sanoop R
Sanoop R
6,015 Points

Yes i think the problem was with these line of code

if($checker->isPalprime())
{
echo "is palprime";
}else
{
echo "is not a palprime.";
}
?>

as i changed into

if($checker->isPalprime())

{ echo "is";

}else{ echo "is not";

} 
echo " a palprime."; ?>

This is not working for me. If i change the other code it just keeps going back and forth no matter what I DO!! HELP!

Long Truong
Long Truong
5,432 Points

Hi jessica,

Can you post your code? Ill take a look and see why it doesnt work