PHP Keywords

PHP has a set of keywords that are reserved words which cannot be used as function names, class names or method names.

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.

keywords are allowed as property, constant, and method names of classes, interfaces and traits, except that class may not be used as constant name.


abstract Declare a class as abstract
and A logical operator
as Used in the foreach loop
break Break out of loops and switch statements
callable A data type which can be executed as a function
case Used in the switch conditional
catch Used in the try..catch statement
class Declare a class
clone Create a copy of an object
const Define a class constant
continue Jump to the next iteration of a loop
declare Set directives for a block of code
default Used in the switch statement
do Create a do...while loop
echo Output text
else Used in conditional statements
elseif Used in conditional statements
empty Check if an expression is empty
enddeclare End a declare block
endfor End a for block
endforeach End a foreach block
endif End an if or elseif block
endswitch End a switch block
endwhile End a while block
extends Extends a class or interface
final Declare a class, property or method as final
finally Used in the try...catch statement
fn Declare an arrow function
for Create a for loop
foreach Create a foreach loop
function Create a function
global Import variables from the global scope
goto Jump to a line of code
if Implement an interface
implements Implement an interface
include Embed code from another file
include_once Embed code from another file

Did you like our works?

We are known for Website Development and Website Designing, along with Android iOS application development in Mumbai, India. Please write us what you think, we would like to hear it from you