Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The solution to the Parse error: syntax error, unexpected T_VAR error in PHP

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report