List of Keywords

These words have special meaning in PHP. Some of them represent things which look like functions, some look like constants, and so on - but they're not, really: they are language constructs. The following words cannot be used as constants, class names, or function names. They are, however, allowed as property, constant, and method names of classes, interfaces and traits, except that class may not be used as constant name.

PHP Keywords
__halt_compiler()abstractandarray()as
breakcallablecasecatchclass
cloneconstcontinuedeclaredefault
die()doechoelseelseif
empty()enddeclareendforendforeachendif
endswitchendwhileeval()exit()extends
finalfinallyfn (as of PHP 7.4) forforeach
functionglobalgotoifimplements
includeinclude_onceinstanceofinsteadofinterface
isset()list()match (as of PHP 8.0) namespacenew
orprintprivateprotectedpublic
readonly (as of PHP 8.1.0) * requirerequire_oncereturnstatic
switchthrowtraittryunset()
usevarwhilexoryield
yield from    

* readonly may be used as function name.

Compile-time constants
__CLASS____DIR____FILE____FUNCTION____LINE____METHOD__
__NAMESPACE____TRAIT__
To Top