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.
Leave a reply