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 trialDaniel Luke
Courses Plus Student 7,151 PointsCalling a Property
I never saw calling a property described, so I'm not exactly sure how to do it. Here is my code:
<?php include ('class.palprimechecker.php'); $checker = new PalprimeChecker(); $checker -> number = 17;
?>
echo "The number "<?php number?> "; echo "(is|is not)"; echo " a palprime.";
?>
Help GREATLY appreciated
1 Answer
John W
21,558 PointsJust as you have assigned 17 to $checker->number
, to retrieve number, you do the same, i.e. $checker->number
To concatenate, you use "." (period/dot), e.g. "abc".$checker->number."def"
will give you abc17def
Finally, echo
is part of php, so you shouldn't close the php <?...?>
block
Daniel Luke
Courses Plus Student 7,151 PointsDaniel Luke
Courses Plus Student 7,151 PointsThank you, sir.