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

I can't get it

PalprimeChecker objects have a property called number. This task has two parts. First, assign that property a value of 17. Second, remove the two hash signs (##) in the first echo statement and instead concatenate the value of this number property. (Be sure to preserve the space after the two hash signs by concatenating a space after the number.)

palprimes.php
<?php

include('class.palprimechecker.php');

$checker = new PalprimeChecker();

$number->17;

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

?>

1 Answer

Alex Heil
Alex Heil
53,547 Points

hey Raul Chiru , I'll try to walk you through this, so let's do it together step by step:

part1: PalprimeChecker objects have a property called number. assign that property a value of 17.

we already created a new PalprimeChecker object and saved it as $checker. So now we can use this one to set the number on it, like this:

$checker->number = 17;

as you see we access the number property on our object and then tell it to hold the number 17. part 1 done ;)

part2: remove the two hash signs (##) in the first echo statement and instead concatenate the value of this number property. (Be sure to preserve the space after the two hash signs by concatenating a space after the number.)

so our end result should be text ("the number") + space + number (the one we created in part1) + space. we can do it like this:

echo "The number " . $checker->number . " ";

we first echo the text with a space after the word. then we use the number from part1 and at the end we add another space, all done using concatenation. that's it - the task will pass just fine.

hope that helped you out - have a nice day ;)