Home / Tutorials / All PHP Reserve Words
All PHP Reserve Words cover

All PHP Reserve Words

Get to know all of the reserved words in PHP and why you can't use it.

2 mins

186

9 months ago

0 comments

Average

There are reserved words in PHP that we can't use to name classes, variables, function parameters, etc. In this post, you will get to know all of them. 

__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 (as of PHP 7.4)
for
foreach
function
global
goto
if
implements
include
include_once
instanceof
insteadof
interface
isset()
list()
match (as of PHP 8.0)
namespace
new
or
print
private
protected
public
readonly (as of PHP 8.1.0) *
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__

All of the above words are reserved words in PHP and you should avoid them at all costs. Thanks for reading.

notion avatar

Alaz

Week-end developer currently experimenting with web, mobile, and all things programming.

Support Us

If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this