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 Build a Simple PHP Application Wrapping Up The Project Objects

Hi. 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"...

Andrew Dushane
Andrew Dushane
9,264 Points

Can you post the code you're entering?

Hi, 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.";

?>

I got response: "It looks like Task 5 is no longer passing."

2 Answers

Gareth Borcherds
Gareth Borcherds
9,372 Points

The 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?

Thank you, Gareth!

Andrew Showalter
Andrew Showalter
14,028 Points

Vaidas,

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()

Thank you, Andrew, very much for your help!