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 trialAdrian Cook
14,032 PointsHello Cuckoo,
Hello I'm stuck at ...
public function getInfo() {
return
"For example"
.$this->common_name.
"on our it might return"
.$this-> flavor.
" tastes. ".
.$this->record_weight.
"The record weighed 14 pounds 8 ounces".
.$this->species .;
Adrian Cook
14,032 PointsHello Cuckoo,
Thank you for the advice. Will check on php.net
1 Answer
Ricardo Hill-Henry
38,442 PointsFirst, I'm not sure why you have the for example text in there and that's the main problem. Secondly, though Hampton uses the dot syntax, when inside strings, it much cleaner to leave them out.
public function getInfo(){
return "$this->species $this->common_name tastes $this->flavor. The record $this->species $this->common_name weighed $this->record_weight.";
}
Adrian Cook
14,032 PointsHello Cuckoo,
Thank you so much for you assistance. I'm just now starting to get a handle on PHP. Just one more question, I was just a little unclear on where to place some of the text (string) in challenge 7, can you please explain the reason why you setup the text as you did in the return? Thanks again
Ricardo Hill-Henry
38,442 PointsI'm not exactly sure what it is you want. I also don't have a lot of experience with PHP. The documentation at php.net should be your best friend. It was just a matter of copy and pasting their string, then placing the variables in that could substitute that static text for a more dynamic return.
Ricardo Hill-Henry
38,442 PointsRicardo Hill-Henry
38,442 PointsCould you post some example code so we can see what you're doing wrong. Also, specify which task you're having trouble on; there is 7.