This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Objects in PHP Forum

View Course » View Exercise

1326 points
Picture
Submitted by
Роман Ганенко
about 4 years ago

Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE on line 14

Here is my code:
<!-- Your code here -->
<?php
class Dog {
public $numLegs = 4;
public $name;
public function_construct($name){
$this->name = $name;
}
}
?>
But preview shows "Parse error: syntax error, unexpected T
STRING, expecting T_VARIABLE on line 14", and task іs passed when i press Submit button.
Any ideas?


3 votes

permalink

I've got it!
There was no space betveen function and __Dog :)

1326 points
Picture
Submitted by
Роман Ганенко
about 4 years ago


2 votes

permalink

I had the same error, I forgot to include the word function before __construct.

Spend an hour trying to figure out why it wasn't working! >:| lol

657 points
Picture
Submitted by
Micheal G Kennedy
about 4 years ago