Home  >  Article  >  php教程  >  PHP error code types

PHP error code types

WBOY
WBOYOriginal
2016-07-11 20:00:442214browse

PHP error parser code list

Different parts of the PHP language are represented internally as T_SR-like types. PHP outputs such identifiers when parsing errors, such as "Parse error: unexpected T_SR, expecting ‘,’ or ‘;’ in script.php on line 10.".

should know what T_SR means. For all those who don't know, the following table lists these identifiers, PHP syntax and references to the appropriate places in the manual.

under PHP 5
代号
Code Syntax Reference
T_ABSTRACT abstract Abstract class (available since PHP 5.0.0)
T_AND_EQUAL &= Assignment operator
T_ARRAY array() array(), array syntax
T_ARRAY_CAST (array) Type conversion
T_AS as foreach
T_BAD_CHARACTER Any character before ASCII 32 except t (0×09), n (0×0a) and r (0×0d)
T_BOOLEAN_AND && Logical operators
T_BOOLEAN_OR || Logical operators
T_BOOL_CAST (bool) or (boolean) Type conversion
T_BREAK break break
T_CASE case switch
T_CATCH catch Exception handling (available since PHP 5.0.0)
T_CHARACTER
T_CLASS class Classes and Objects
T_CLONE clone Classes and objects. Only for PHP 5.
T_CLOSE_TAG ?> or %>
T_COMMENT // or #, and /* */Notes
T_CONCAT_EQUAL .= Assignment operator
T_CONST const
T_CONSTANT_ENCAPSED_STRING “foo” or ‘bar’ String syntax
T_CONTINUE continue
T_CURLY_OPEN
T_DEC increment/decrement operators
T_DECLARE declare declare
T_DEFAULT default switch
T_DIV_EQUAL /= 赋值运算符
T_DNUMBER 0.12,等等 浮点数
T_DOC_COMMENT /** */ PHPDoc 风格的注释(仅用于 PHP 5)
T_DO do do..while
T_DOLLAR_OPEN_CURLY_BRACES ${ 复杂变量解析语法
T_DOUBLE_ARROW => 数组语法
T_DOUBLE_CAST (real), (double) 或 (float) 类型转换
T_DOUBLE_COLON :: 见下面的 T_PAAMAYIM_NEKUDOTAYIM
T_ECHO echo echo()
T_ELSE else else
T_ELSEIF elseif elseif
T_EMPTY empty empty()
T_ENCAPSED_AND_WHITESPACE
T_ENDDECLARE enddeclare declare, alternative syntax
T_ENDFOR endfor for, alternative syntax
T_ENDFOREACH endforeach foreach, alternative syntax
T_ENDIF endif if, alternative syntax
T_ENDSWITCH endswitch switch, alternative syntax
T_ENDWHILE endwhile while, alternative syntax
T_END_HEREDOC heredoc syntax
T_EVAL eval() eval()
T_EXIT exit or die exit(), die()
T_EXTENDS extends extends, classes and objects
T_FILE __FILE__ Constant
T_FINAL final Final keyword (available since PHP 5.0.0)
T_FOR for for
T_FOREACH foreach foreach
T_FUNCTION function or cfunction Function
T_GLOBAL global Variable scope
T_HALT_COMPILER __halt_compiler() __halt_compiler (available since PHP 5.1.0)
T_IF if if
T_IMPLEMENTS implements Interface (available since PHP 5.0.0)
T_INC Increment/Decrease Operator
T_INCLUDE include() include()
T_INCLUDE_ONCE include_once() include_once()
T_INLINE_HTML
T_INSTANCEOF instanceof type operators (PHP5 only)
T_INT_CAST (int) or (integer) Type conversion
T_INTERFACE interface Interface (available since PHP 5.0.0)
T_ISSET isset() isset()
T_IS_EQUAL == Comparison operators
T_IS_GREATER_OR_EQUAL >= Comparison operators
T_IS_IDENTICAL === Comparison operators
T_IS_NOT_EQUAL != or Comparison operators
T_IS_NOT_IDENTICAL !== Comparison operators
T_IS_SMALLER_OR_EQUAL Comparison operators
T_LINE __LINE__ Constant
T_LIST list() list()
T_LNUMBER 123, 012, 0×1ac, etc. integer
T_LOGICAL_AND and Logical operators
T_LOGICAL_OR or Logical operators
T_LOGICAL_XOR xor Logical operators
T_MINUS_EQUAL -= Assignment operator
T_ML_COMMENT /* and */ Comments (PHP 4 only)
T_MOD_EQUAL %= Assignment operator
T_MUL_EQUAL *= Assignment operator
T_NEW new Classes and Objects
T_NUM_STRING
T_OBJECT_CAST (object) Type conversion
T_OBJECT_OPERATOR -> Classes and Objects
T_OPEN_TAG Escaped from HTML
T_OPEN_TAG_WITH_ECHO = or Escaped from HTML
T_OR_EQUAL |= Assignment operator
T_PAAMAYIM_NEKUDOTAYIM :: ::. Also defined as T_DOUBLE_COLON.
T_PLUS_EQUAL = Assignment operator
T_PRINT print() print()
T_PRIVATE private Classes and objects. Only for PHP 5.
T_PUBLIC public Classes and objects. Only for PHP 5.
T_PROTECTED protected Classes and objects. Only for PHP 5.
T_REQUIRE require() require()
T_REQUIRE_ONCE require_once() require_once()
T_RETURN return Return value
T_SL bit operators
T_SL_EQUAL Assignment operator
T_SR >> bit operators
T_SR_EQUAL >>= Assignment operator
T_START_HEREDOC heredoc syntax
T_STATIC static Variable scope
T_STRING
T_STRING_CAST (string) Type conversion
T_STRING_VARNAME
T_SWITCH switch switch
T_THROW throw Exception handling (available since PHP 5.0.0)
T_TRY try Exception handling (available since PHP 5.0.0)
T_UNSET unset() unset()
T_UNSET_CAST (unset) (no documentation; type is NULL)
T_USE
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn