Reserved/keywords-Phpdoc专题
关键词列表
这些词语在 PHP 中有着特殊的意义。它们中有些像是函数,有些像是常量……但是它们不是的,它们只是语言结构的一部分。不能使用它们的任何一个作为常量、方法名或是类名。但是可以将它们作为变量名使用,不过这样会导致混淆。
从PHP7.0.0开始这些关键字允许被用作类的属性、常量以及类的方法名,或者接口名和traints名,除了class不能被用作常量名。
__halt_compiler | abstract | and | array | as |
break | callable (as of PHP 5.4) | case | catch | class |
clone | const | continue | declare | default |
die | do | echo | else | elseif |
empty | enddeclare | endfor | endforeach | endif |
endswitch | endwhile | eval | exit | extends |
final | finally (从PHP 5.5开始) | for | foreach | function |
global | goto (从PHP 5.3开始) | if | implements | include |
include_once | instanceof | insteadof (从PHP 5.4开始) | interface | isset |
list | namespace (从PHP 5.3开始) | new | or | |
private | protected | public | require | require_once |
return | static | switch | throw | trait (从PHP 5.4开始) |
try | unset | use | var | while |
xor | yield (从PHP 5.5开始) |
CLASS | DIR (从PHP 5.3开始) | FILE | FUNCTION | LINE | METHOD |
NAMESPACE (从PHP 5.3开始) | TRAIT (从PHP 5.4开始) |