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 trialShelby Jamison
Courses Plus Student 10,747 PointsHaving problems with the mid course challenge of Object-Oriented PHP
I'm having problems with task 4 of this code challenge. Can I be given hints how to solve this?
<?php
class Fish {
public $common_name;
public $flavor;
public $record_weight;
function __construct($name,$flavor,$record){
$this->common_name = $name;
$this->flavor = $flavor;
$this->record_weight = $record;
}
$bass = new Fish("Largemouth Bass", "Excellent", "22 pounds 5 ounces");
}
?>
4 Answers
Kristian Terziev
28,449 PointsHello Shelby,
You said to give you a hint so I wont spoil it for you. You have a mistake. Take a closer look at the places where you have put the curly braces. If you can't find it write again and I'll tell you the problem.
Shelby Jamison
Courses Plus Student 10,747 PointsIt worked, thanks
Shelby Jamison
Courses Plus Student 10,747 Points Okay now, I'm having problems with task 5, again only hints. I added public function getInfo with returns, the $this-> code with product name being fish then common_name, flavor, record_weight.
Kristian Terziev
28,449 PointsHello Shelby,
I cant seem to find which task 5 are you talking about. Could you give me a link?
Hammad Ahmed
Full Stack JavaScript Techdegree Student 11,910 PointsHammad Ahmed
Full Stack JavaScript Techdegree Student 11,910 PointsTake a close look at your closing brace of the class, it should be closed before the declaration.