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

Shaun Gehrke
Shaun Gehrke
742 Points

Your quizes donot follow the videos

Lame

fish.php
<?php 

class Fish {

    public $common_name;
    public $flavor;
    public $record_weight;

  function __construct(){
    $this->$name = $common_name;
    $flavor;
    $record;
  }
}

?>

2 Answers

peyton caseria
PLUS
peyton caseria
Courses Plus Student 12,281 Points

They do this so you have to do more than just follow along, If you are wanting to get into this field professionally. It's a great exercise. Although I do wish they elaborated this a little more!

Shaun Gehrke
Shaun Gehrke
742 Points

Define a constructor method on the Fish class with 3 parameters, in order, named $name, $flavor, and $record.

<?php

class Fish { public $common_name; public $flavor ; public $record_weight; } function __construct($name, $flavor, $record){ } ?>

I guess what I meant to say is that they should have better hints. ( Bummer! Did you create a constructor (__construct)? )

Here is the answer if you want it :

<?php

class Fish { public $common_name = ""; public $flavor = ""; public $record_weight = "";

function __construct($name, $flavor, $record) {

}

}

?>

I recommend googling questions and using stackoverflow as resources