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

Barnabás Makkay
Barnabás Makkay
6,661 Points

Build a Simple PHP Application => PalPrime Challenge Task 5 (Error message: "... Double check the output!")

I checked my code in the preview and it is definitely working as (at least I) expected. I can't go further and I'm confused now. Please take a look at my code and tell me what's the problem!

palprimes.php
<?php

include("class.palprimechecker.php");
$checker = new PalprimeChecker();
$checker->number = 17;

echo $checker->number;

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

echo " a palprime.";

?>

1 Answer

Rasbin Rijal
PLUS
Rasbin Rijal
Courses Plus Student 10,864 Points

Hello @Barnabas, this should work

<?php
require("class.palprimechecker.php");
$checker = new PalprimeChecker;
$checker->number = 17;

if($checker->isPalprime()) {
echo "The number " .  $checker->number . "  ". "is a palprime." ;
}  else {
  echo  "The number " .   $checker->number . "is not a palprime";
}
?>
Barnabás Makkay
Barnabás Makkay
6,661 Points

I'm currently not learning on treegouse, hence I cannot test, but it seems OK.