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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Paul Mather](https://secure.gravatar.com/avatar/010cb6dd74347cee3bdb635726120195?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Paul Mather
3,313 PointsOOP Construct Method - code incorrect?
I'm doing the OOP track and, when writing the exact same code as in the video, it echos out "default_name" instead of what it does in the test (obviously my text differs slightly from that in the video, but everything else is the same).
Any idea why it's displaying "default_name" instead of "Testing"?
class Product {
public $name = "default_name";
public $price = 0;
public $desc = "default description";
function __contruct($name, $price, $desc) {
$this->name = $name;
$this->price = $price;
$this->desc = $desc;
}
public function getInfo() {
return "Product Name: ". $this->name;
}
}
$p = new Product();
$shirt = new Product("Testing", 34.99, "An amazing T-Shirt");
echo $shirt->getInfo();
?> ```
3 Answers
![Jesse Richard](https://secure.gravatar.com/avatar/f30d2ed5003bf36776ee3b9c2781ad8e?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jesse Richard
1,899 PointsCheck out your constructor name. It's very, very close....
![Casey Ydenberg](https://secure.gravatar.com/avatar/5c1be62a103d55f642aac2205ca2b3e6?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Casey Ydenberg
15,622 Pointsconstruct is misspelled
![Paul Mather](https://secure.gravatar.com/avatar/010cb6dd74347cee3bdb635726120195?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Paul Mather
3,313 PointsOh wow, i can't believe i missed that! I looked over it at least 10 times.
Thanks Jesse, i really appreciate you taking a look.
![Jesse Richard](https://secure.gravatar.com/avatar/f30d2ed5003bf36776ee3b9c2781ad8e?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jesse Richard
1,899 PointsNo problem. Happens to me all the time!