问题
I will be grateful if someone can point out where the error is occurring.
class hotel extends WishDBxyz{
public nomhotel;
protected idhotel, ile_idile, pays_idpays, chainehotel_idchainehotel, actif ;
}
Just on second line got the error Parse error: syntax error, unexpected (T_STRING), expecting variable (T_VARIABLE). I'm quite new to Object Oriented PHP and writting one class inheriting another class.
回答1:
Those are variables in php.So add the $
sign:
class hotel extends WishDBxyz{
public $nomhotel;
protected $idhotel, $ile_idile, $pays_idpays, $chainehotel_idchainehotel, $actif ;
}
回答2:
you are missing the $
public $var;
see http://www.php.net/manual/en/language.oop5.basic.php
回答3:
You are missing $ in variables
class hotel extends WishDBxyz{
public $nomhotel;
protected $idhotel, $ile_idile, $pays_idpays, $chainehotel_idchainehotel, $actif ;
}
回答4:
From the PHP manual page:
Variables in PHP are represented by a dollar sign followed by the name of the variable. The variable name is case-sensitive.
So for your case, you'd put something like:
class Hotel extends WishDBxyz{
public $nomhotel;
protected $idhotel, $ile_idile, $pays_idpays, $chainehotel_idchainehotel, $actif ;
}
For examples on declaring classes, properties, methods, etc., look at the PHP manual.
(As a habit, I usually use UpperCamelCase for the class name)
回答5:
Variable names should be prefixed with $
来源:https://stackoverflow.com/questions/21930748/parse-error-syntax-error-unexpected-t-string-expecting-variable-t-variable