关键词列表

这些词语在 PHP 中有着特殊的意义。它们中有些像是函数,有些像是常量,但是它们不是真的,它们只是语言结构的一部分。不能使用它们的任何一个作为常量、类名、函数或方法名。但是它们可以被用作类的属性、常量以及类的方法名,或者接口名和 traits 名,除了 class 不能被用作常量名。

PHP 关键词
__halt_compiler() abstract and array() as
break callable 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 fn (从 PHP 7.4 开始) for foreach
function global goto if implements
include include_once instanceof insteadof interface
isset() list() match (从 PHP 8.0 开始) namespace new
or print private protected public
require require_once return static switch
throw trait try unset() use
var while xor yield yield from
编译时常量
__CLASS__ __DIR__ __FILE__ __FUNCTION__ __LINE__ __METHOD__
__NAMESPACE__ __TRAIT__
7i24.Com