Robbie Thomas31,092 Points
Adding A Basic Form: Objects / Challenge 3 of 4
Here is the code:
<?php include("class.palprimechecker.php"); $checker = new PalprimeChecker; $number->$checker = 17 // trouble with this line echo "The number " . $number; echo "(is|is not)"; echo " a palprime."; ?>
Having troubles with $number->$checker = 17, any help would do.
<?php echo "The number ## "; echo "(is|is not)"; echo " a palprime."; ?>
You have the object and property reversed on that line. When using the arrow operator, you have the object on the left and the property or method you're trying to access on the right. $number doesn't need a dollar sign either because you already have one on $checker to indicate it's a variable. And you have to end the line with a semicolon.
$checker->number = 17;
The other issue is with the echo statement. You have to access the number property through the checker object and the challenge mentions that you should preserve the space after the number.
echo "The number " . $checker->number . " ";
Pai BoonyPro Student 4,529 Points
thanks Robert for the question, I had the same problem. And also thanks to Jason I can solve my problem coz your answer.