Php Parse Error Syntax Error Unexpected T_var Expecting T_variable
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us unexpected var php Learn more about Stack Overflow the company Business Learn more about hiring developers or syntax error, unexpected (t_variable), expecting ',' or ';' posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow expecting variable (t_variable) Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up PHP classes, parse syntax errors when using 'var'
Parse Error, Expecting Variable (t_variable)"'
to declare variables up vote 3 down vote favorite 1 I am a C# guy trying to translate some of my OOP understanding over to php. I'm trying to make my first class object, and are hitting a few hitches. Here is the beginning of the class: GetID()); while($projectArray[$i] != null) { $projectArray[$i] = new Project($projectArray[$i]); } UserDB.php is where I have all my static functions interacting with the Database for this User Class. I am getting errors using when I use var, and I'm getting confused. I know I don't HAVE to use var, or declare the variables at all, but I feel it is a better practice to do so. the error is "unexpected T_VAR, expecting T_VARIABLE" When I simply remove var from the declarations it works. Why is this? php mysql syntax object share|improve this question asked May 29 '10 at 13:06 user48202 441522 add a comment| 1 Answer 1 active oldest votes up vote 11 down vote accepted You are mixing things up. Before PHP 5 it was var $uid; Since PHP 5 it is private $uid; // or protected $uid; // or public $uid; You can read about it in the Properties documentation: Note: In order to maintain backward compatibility with PHP 4, PHP 5 will
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business syntax error unexpected expecting & or variable t_variable Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation
Php Unexpected T_variable
Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just
Parse Error Syntax Error Unexpected Expecting & Or Variable T_variable Laravel
like you, helping each other. Join them; it only takes a minute: Sign up Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' [closed] up vote -3 down vote favorite 1 im doing this project for http://stackoverflow.com/questions/2935164/php-classes-parse-syntax-errors-when-using-var-to-declare-variables my php class I have included the code. I cannot figure out what the syntax error is. I have changed things many times but nothing works. Can someone help me. thanks!