On this page, you will find the Keywords used in PHP for various functions. You cannot use these keywords to name the variables, functions, methods, and classes. These keywords perform predefined operations.

KeywordDescription
abstractDeclare a class as abstract
andA logical operator
asUsed in the foreach loop
breakBreak out of loops and switch statements
callableA data type that can be executed as a function
caseUsed in the switch conditional
catchUsed in the try..catch statement
classDeclare a class
cloneCreate a copy of an object
constDefine a class constant
continueJump to the next iteration of a loop
declareSet directives for a block of code
defaultUsed in the switch statement
doCreate a do…while loop
echoOutput text
elseUsed in conditional statements
elseifUsed in conditional statements
emptyCheck if an expression is empty
enddeclareEnd a declared block
endforEnd a for block
endforeachEnd a foreach block
endifEnd an if or elseif block
endswitchEnd a switch block
endwhileEnd a while block
extendsExtends a class or interface
finalDeclare a class, property, or method as final
finallyUsed in the try…catch statement
fnDeclare an arrow function
forCreate a for loop
foreachCreate a foreach loop
functionCreate a function
globalImport variables from the global scope
gotoJump to a line of code
ifCreate a conditional statement
implementsImplement an interface
includeEmbed code from another file
include_onceEmbed code from another file
instanceofTest an object’s class
insteadofResolve conflicts with traits
interfaceDeclare an interface
issetCheck if a variable exists and is not null
listAssign array elements into variables
namespaceDeclare a namespace
newCreate an object
orA logical operator
printOutput text
privateDeclare a property, method, or constant as private
protectedDeclare a property, method, or constant as protected
publicDeclare a property, method, or constant as public
requireEmbed code from another file
require_onceEmbed code from another file
returnExit a function and return a value
staticDeclare a property or method as static
switchCreate a switch block
throwThrow an exception
traitDeclare a trait
tryCreate a try…catch structure
unsetDelete a variable or array element
useUse a namespace
varDeclare a variable
whileCreate a while loop or end a do…while loop
xorA logical operator
yieldUsed in generator functions
yield fromUsed in generator functions
PHP keywords