parse error, unexpected T_STRING

Parse Errors

What The PHP Error Message Says:

Parse error: parse error, unexpected T_STRING in /home/virtual/site5/fst/var/www/html/akash/errors.php on line 11

What Causes This PHP Error To Occur?

A parse error occurs whenever a PHP compiler is attempting to translate your code, this is also referred to in programming terms as a “runtime error”

It is often easily fixable, as the problem is often simple. The problem stems form the syntax of your code.

This may be because you forgot to add a semi-colon on the end of one of your lines of code “;” this is usually the most frequent problem especially when you first start learning PHP as its easy to forget that each line code needs to finish with this character and to the untrained eye its hard to spot when glancing at the code.

The second and third most common mistake with the syntax is when you forget to include the double quote (") or an end bracket (}) after you have created one. This can mean that the error will not be on the line of code where the error should be, but might be at the end of your program.




How To Fix The Problem

The best method for fixing “parse errors” is to find the line which PHP is saying caused the error.

Parse error: parse error, unexpected T_STRING in /home/virtual/site5/fst/var/www/html/akash/errors.php on line 11

As you can see in the example above the number displayed at the end saying “on line 11” is the suspected location of the error. To find this line you can count down the lines of code including white space (made by the return key) to located the suspected line.

If you notice that you have missed one of the semi-colons “;” then inset one and test the code once more to see if all the errors have been resolved

However if the line number mentioned happens to be at the end of your code, then you will have to go back and look through out all your code to see if all the { } and “ ” are set up properly

To find them more easily you can use the find facility that is available in most editors including notepad for windows.

If you have a more sophisticated editor they usually highlight anything inside the quotation marks “ “ a different colour. If you like to make your code laid out in the right manner then you can use tab on all the { } to make sure they line up as this will allow you to spot the missing brackets quickly





Top Queries

1. parse error: parse error, unexpected t_string
2. php unexpected t_string
3. unexpected t_string
4. php parse error: parse error, unexpected $
5. "parse error, unexpected t_string in " php
6. "parse error: parse error, unexpected t_string"
7. common gateway interface php
8. parse error t_string
9. parse error unexpected t_string
10. parse error: parse error, unexpected
11. parse error: parse error, unexpected $end
12. parse error: parse error, unexpected '<'
13. parse error: parse error, unexpected '}'
14. parse error: parse error, unexpected t_string + php
15. parse error: syntax error, unexpected t_string
16. parse error: syntax error, unexpected t_string code
17. parse error: syntax error, unexpected t_string in /var/www/html
18. parse error: syntax error, unexpected t_string windows
19. php "unexpected t_string in"
20. php if contains unexpected t_string
21. php parse error: parse error, unexpected t_string
22. php parse error: parse error, unexpected t_string in
23. php php parse error: parse error, unexpected $
24. php+error+parse error
25. syntax error, unexpected '!' php
26. syntax error, unexpected t_string
27. t_string php what is
28. unexpected t_string php
29. what is a parse error in php
30. what is parse error, unexpected t_string