Keywords in PHP language


PHP Keywords

Keywords are reserved words.

Their meaning and purpose is already defined within the PHP. Keywords must be used only for the purpose for which they are defined.

All keywords are defined in lower case letters. Hence keywords must be written in lower case letters.

Keywords should not be used as identifiers or user defined names;
i.e. for naming variables, constants, arrays, functions, objects, etc. do not use keywords

Ex (65+):

echo, print, eval
if, endif, else, elseif
switch, endswitch, case, default
for, endfor, while, endwhile, do
foreach, endforeach, as, yield
break, continue, goto
function, return, callable, global
array, list
try, catch, throw, finally
new, clone, instanceof
and, or, xor
class, interface, namespace
var, static, const
private, protected, public
abstract, final
extends, implements
include, include_once, require, require_once
declare, enddeclare
die, exit
empty, isset, unset
trait, insteadof, use

Interview Questions:

1. PHP stands for ______________
a. Hypertext Preprocessor
b. Preprocessor Hypertext
c. Personal Home Processor
d. Personal Hypertext processor
Ans: a