Keywords in PHP Language
In this article, we will see about keywords in PHP language.
What is Keywords
- Keywords are reserved words. Their meaning and purpose are 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 lowercase letters.
- Keywords should not be used as identifiers or user-defined names;
i.e for naming variables, constant, arrrays, functions, objects, etc do not use keywords.
Example (keywords in PHP):
- echo – to display some text or some value in the browser.
- if – to execute some set of statements based on the condition.
- switch
- for
- foreach
- break
- function
- array
- try
- new
- and
- class
- var
- private
- abstract
- extends
- include
- declare
- die
- empty
- trait
- endif
- endswitch
- endfor
- endforeach
- continue
- return
- atch
- clone
- or
- interface
- static
- protected
- final
- implements
- include_once
- enddeclare
- exit
- isset
- insteadof
- eval
- else
- case
- while
- as
- goto
- callable
- throw
- xor
- namespace
- public
- require
- unset
- use
- elseif
- default
- endwhile
- yield
- global
- finally
- instanceof
- require_once
- do
Conclusion
So, there are 64+ keywords in PHP.