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

Objects in PHP Forum

View Course » View Exercise

0 points
Picture
Submitted by
Vidya Pax
over 3 years ago

Parse error: syntax error, unexpected 'nomhotel' (T_STRING), expecting variable (T_VARIABLE)

class hotel extends WishDB{
public namehotel;
protected active ;

}

I tried to call his php page and just on the second line
public namehotel;
got the error Parse error: syntax error, unexpected 'nomhotel' (TSTRING), expecting variable (TVARIABLE)


1 vote

permalink

You've named a variable or if you'd rather since it's OOP, a property, but you haven't declared it. The $ sign is how you declare a variable.

public $namehotel;

965 points
510cf70685cb78845600421e_309033413
Submitted by
randy cramer
over 3 years ago