All Vskills Certification exams are ONLINE now. You may take from any where any time | Please use #TOGETHER for 20% discount

Certified PHP Developer Learning Resources Anonymous Functions

Anonymous Functions
 


Anonymous functions, also known as closures, allow the creation of functions which have no specified name. They are most useful as the value of callback parameters, but they have many other uses.

Example - Anonymous function example
echo preg_replace_callback('~-([a-z])~', function ($match) {
    return strtoupper($match[1]);
}, 'hello-world');
// outputs helloWorld
?>