First class functions

A language with first-class functions allows the following behavior:

  • Assign a function to a variable
  • Pass them to another function as an argument
  • Return a function

PHP supports all of these behaviors and, hence, PHP functions are first-class functions. In our previous example, the ucfirst function is an example of a first-class function.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset