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 Object-Oriented PHP Basics (Retired) Properties and Methods Mid-Course Challenge

Having 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?

fish.php
<?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");
}

?>

Take a close look at your closing brace of the class, it should be closed before the declaration.

4 Answers

Hello 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.

It worked, thanks

  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.

Hello Shelby,

I cant seem to find which task 5 are you talking about. Could you give me a link?