Anything that requires a temporary function that you probably will only use once.
I would use them for callbacks, for functions such as:
- usort
- preg_replace_callback
E.g.
usort($myArray, function ($a, $b) {
return $a < $b;
});
Before 5.3, you’d have to..
function mySort ($a, $b) {
return $a < $b;
}
usort($myArray, 'mySort');
Or create_function …
usort($myArray, create_function('$a, $b', 'return $a < $b;'));