From the course: Functional Programming with PHP
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Returning functions - PHP Tutorial
From the course: Functional Programming with PHP
Returning functions
- [Instructor] So far we've seen that it's possible to define functions in pretty much the same way we define other things such as strings and numbers and we've also seen that it's possible to pass functions as arguments, again, similar to other types. So the next logical thing for us to look at with respect to first class functions is our ability to return functions from other functions. Now the usefulness of first class functions has been kind of limited up until now without this final piece of our first class functions puzzle. This is a place where the flexibility that first class functions give us really starts to shine through. First let's try and wrap our heads around the basic concept of functions that return functions. In programming it's common to hear functions referred to as a black box. You put data into the box and you get some data out. If we're talking about a function called double for example, we…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.