You are currently viewing What are Keywords in PHP Language
  • Post category:PHP

What are Keywords in PHP Language

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):

  1. echo – to display some text or some value in the browser.
  2. if – to execute some set of statements based on the condition.
  3. switch
  4. for
  5. foreach
  6. break
  7. function
  8. array
  9. try
  10. new
  11. and
  12. class
  13. var
  14. private
  15. abstract
  16. extends
  17. include
  18. declare
  19. die
  20. empty
  21. trait
  22. print
  23. endif
  24. endswitch
  25. endfor
  26. endforeach
  27. continue
  28. return
  29. atch
  30. clone
  31. or
  32. interface
  33. static
  34. protected
  35. final
  36. implements
  37. include_once
  38. enddeclare
  39. exit
  40. isset
  41. insteadof
  42. eval
  43. else
  44. case
  45. while
  46. as
  47. goto
  48. callable
  49. throw
  50. xor
  51. namespace
  52. public
  53. require
  54. unset
  55. use
  56. elseif
  57. default
  58. endwhile
  59. yield
  60. global
  61. finally
  62. instanceof
  63. require_once
  64. do

Conclusion

So, there are 64+ keywords in PHP.

Leave a Reply