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

Shilpa Kothari
Shilpa Kothari
4,518 Points

define construct

<?php

"this from the first challenge"

class Fish { public $common_name = 'default_name'; public $flavor = 'taste'; public $record_weight = 0;

"I am not able to understand what is wrong below"

fuction__construct($name, $flavor, $record){ $this->name = $name;
$this->flavor = $flavor;
$this->record = $record;
}

}

fish.php
<?php

class Fish 
{
  public $common_name = 'default_name';
  public $flavor = 'taste';
  public $record_weight = 0;


  fuction__construct($name, $flavor, $record){
                 $this->name = $name;  
                 $this->flavor = $flavor;  
                 $this->record = $record;  
    }

}






?>

2 Answers

Shilpa

You misspelled the word function and you need a space between that function keyword and the __construct function name.

fuction__construct()

...should be...

function __construct()

This should fix your problem and pass the challenge.

Cheers!

Shilpa Kothari
Shilpa Kothari
4,518 Points

Its not working. does the "public $common_name " and the contruct variable $name creating the problem. I am not able to understand.