Anonymous functions can be assigned to variables for use as parameters where a callback is expected:
$uppercase = function($data) {
return strtoupper($data);
};
$mixedCase = ["Hello", "World"];
$uppercased = array_map($uppercase, $mixedCase);
print_r($uppercased);
These variables can also be used as standalone function calls:
echo $uppercase("Hello world!"); // HELLO WORLD!