It’s possible if you are using PHP 5.3.0 or higher.
See Anonymous Functions in the manual.
In your case, you would define exampleMethod
like this:
function exampleMethod($anonFunc) {
//execute anonymous function
$anonFunc();
}
More Related Contents:
- What does \n mean [duplicate]
- How i can earn variable from string in PHP? [closed]
- PHP function to generate v4 UUID
- What in layman’s terms is a Recursive Function using PHP
- Recursive function to generate multidimensional array from database result
- How to Truncate a string in PHP to the word closest to a certain number of characters?
- PHP echo vs PHP short echo tags
- What is the difference between PHP echo and PHP return in plain English?
- Is it possible to overwrite a function in PHP
- Get title of website via link
- How do I immediately execute an anonymous function in PHP?
- Redefining PHP function?
- Equivalent of include() in HTML
- Is it possible to replace a function in php (such as mail) and make it do something else?
- PHP Array Syntax Parse Error Left Square Bracket “[” [closed]
- Delete digits after two decimal points, without rounding the value
- How do I remove the URL protocol and slash from user input in PHP
- PHP function flags, how?
- How to use include within a function?
- Multiple excerpt lengths in wordpress
- The advantage / disadvantage between global variables and function parameters in PHP?
- PHP: variable not working inside of function?
- Is it possible to visualize a bunch of functions in UML
- What Does Using A Single Pipe ‘|’ In A Function Argument Do?
- How to get last insert Id in SQLite?
- Override default php function
- PHP Optional Parameters – specify parameter value by name?
- When to use a Class vs. Function in PHP
- PHP pass function name as param then call the function?
- How can you use php in a javascript function [duplicate]