PHP reserved keywords
PHP reserved keywords are group of keywords which cannot be used as class name or function name in PHP. The keyword list below shows the keywords, constants, class names, and predefined variables. They are: abstract( PHP5 ), and(), as(), break(), callable(), case(), catch(), class(), clone(PHP5), const(), empty(), e...

About PHP reserved keywords
PHP reserved keywords are group of keywords which cannot be used as class name or function name in PHP. The keyword list below shows the keywords, constants, class names, and predefined variables. This names or keyword should not be used as variable names, class names, constants, as they might cause errors or might lead the developer into confusion while writing in PHP language.
This names and keywords has meanings in PHP and does its own work, so using them to declare variables or class names as it is a bad PHP practice. The keywords are listed below.
PHP reserved keywords
Keywords |
Meaning |
abstract( PHP5 ) |
Used to declare a class as abstract |
and() |
Is a logical operator |
as() |
For Usage in foreach loop |
break() |
To Break out of switch statements or loops |
callable() |
Is a data type that can be called as a function in PHP |
case() |
This is used in the switch conditional statements |
catch() |
This is used to catch a statement. Used in try statement |
class() |
To declare a class |
clone(PHP5) |
this is used to create a duplicate of an object |
const() |
Used to define a constant |
continue() |
Used to Jump to the next iteration of a loop |
declare() |
Used to Declare a code |
default() |
This is used in the switch statement to create a default case |
do() |
Used in loops e.g do...while loop |
Die() |
To end a code |
Exit() |
To end a code |
echo() |
To print a statement, just like print |
else() |
This is used in conditional statements like if..else |
elseif() |
For conditional statements. To alternate an if statement |
empty() |
This is used to check if an input or a code value is empty |
enddeclare() |
To end a block that is decleared |
endfor() |
Used too end a for code |
endforeach() |
used to end a foreach code |
endif() |
used to end an if or elseif code |
endswitch() |
Used to end a switch code |
endwhile() |
Used to end a while code |
extends() |
This is used to extend a class |
final() |
To declare a property or a class as the final |
fn() |
This is used to declare an arrow function |
for() |
for declaring a PHP for loop |
foreach() |
To create a PHP foreach loop |
function() |
This is used to create a function |
global() |
Adds variables that is set to global |
goto() |
Go to another line of code |
if() |
To create a conditional statement e.g if...esle... |
implements() |
To implement an interface |
include() |
To add a code from another source |
include_once() |
To add a code from another source once |
isset() |
this is used to know if a variable is set or exists |
namespace() |
This is used to declares a namespace |
new() |
To create a new object |
or() |
This is a logical operator to take alternation |
print() |
To echo or show the executed code. displays on the screen |
require() |
To add a code from another source or file |
require_once() |
To add a code from another source or file once |
return() |
This is used in functions to exit and return the value |
switch() |
This is used to declare a switch code |
throw() |
this is used to throw an exception e.g errors |
trait() |
Used to declare a trait |
try() |
Used to create a try and catch statement |
unset() |
Used to unset and delete a variable |
var() |
This is used to declare a variable |
while() |
This is used to create a while loop |
xor() |
This is used for logical operations |
yield() |
Is used in generator functions |