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 trialRich Mathis
3,626 PointsObject Properties
In the following code, I can't figure out how to add a property to the object "PalprimeChecker".
'''php <?php
include ("class.palprimechecker.php");
$checker = new PalprimeChecker (17);
echo "The number " . $checker . " "; echo "(is|is not)"; echo " a palprime.";
?> '''
2 Answers
Jeff Busch
19,287 PointsHi Rich,
First, we know that the variable $checker has been assigned a new PalprimeChecker object, so let's work with $checker. We are going to create a property called number and assign a value of 17 to it. Below is what that line of code will look like. Try it and see if you can continue.
Jeff
<?php
$checker = new PalprimeChecker;
$checker->number = 17;
?>
If you look to the bottom right of the text box you will see something that says Markdown Cheetsheet. If you don't understand that maybe this will make sense: How to display code at Treehouse
Rich Mathis
3,626 PointsThank you! That helped a bunch.