Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 7. Functions > Managing Dynamic Function Calls

Managing Dynamic Function Calls

Chapter 6 shows you how to pass a customized sort function into a predefined sorting function. The ability to do so, in your own library functions, is a powerful tool. This section will demonstrate how you pass a function name to make a dynamic function call.

The mechanism to make dynamic function calls is tied to how variables are managed in PHP. You can define a function in your page, or library, and then pass the name of the function as a string and its parameters as a list to another function. Inside the function, you append parentheses containing the actual parameter list to the variable that contains the function name. This statement makes a dynamic function call to the function represented by the string and uses a parameter list that can contain static values, variables, or an array of values.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial