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 Basic PHP Website (2018) Adding a Basic Form Objects

It looks like Task 1 is no longer passing.

objects

palprimes.php
<?php
include"class.palprimechecker.php";
$checker=new PalprimeChecker(number=17);




echo "The number $checker ";
echo "(is|is not)";
echo " a palprime.";

?>

1 Answer

Matthew Caloger
Matthew Caloger
12,903 Points

You'll need to use the following:

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

echo "The number" .  $checker->number;
echo "(is|is not)";
echo " a palprime.";
?>

remove the "number=17" from the constructor of the PalprimeChecker, and add a new line with "$checker->number = 17;" $name -> value allows you to access a property and assign a value. In the echo, you'll want to use "." to concatenate, then "$checker->number" to retrieve the number.