The solution to the Parse error: syntax error, unexpected T_VAR error in PHP
The main content of this article is to explain the solution of Parse error: syntax error, unexpected T_VAR error in PHP. Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "PHP appears Parse error: syntax error, unexpected T_VAR error solution" bar!
In fact, this is a very easy problem to solve. In my opinion, deja vu, hehe, recently I learned to use JavaScript to declare variables using var.
In fact, you don't need to use var declaration in PHP at all, but when a variable is a member of a class, there is no problem using var.
Use var externally to report an error Parse error: syntax error, unexpected T_VAR in..., such as my error message:
Parse error: syntax error, unexpected T_VAR in D:\ Apache2.2\ htdocs\ shirdrn\ page\ p2\ pageUtil.inc on line 34
I was testing: an error occurred when using a self-defined class object as a member of a class inside a class.
The address.inc code for the Address class:
The copy code is as follows:
The Person class and its test code are person.php as follows:
The copy code is as follows:
An exception occurred when the test failed:
Parse error: syntax error, unexpected T_VAR in D:\ Apache2.2\ htdocs\ shirdrn\ page\ p2\ pageUtil.inc on line 34
Just because you use var to declare variables in person.php code, you can't do this in PHP, as long as you start with a "$" symbol to indicate that the character is followed by a PHP variable.
Hehe: -)
At this point, I believe you have a deeper understanding of the "Parse error: syntax error, unexpected T_VAR error solution to PHP". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!