Search code examples
phpparse-error

Why do all PHP parse errors start with "T_"?


I just want to know is whether there is any reason/story behind to use T_ before parse errors like

parse error : unexpected `T_`ELSE in ... blah blah blah  
parse error : Unexpected `T_`IF in ....blah   
parse error : unexpected `T_`VAR  
parse error : unexpected `T_`STRING

and many more.

Can you provide any link for clarification? Also, are there any other prefixes used in error displaying then please share.


Solution

  • T stands for Token.

    These errors are telling you that the parser found a token that it didn't expect.