Avoid anonymous function for PHP 5.2 compatibility

Removed usages of create_function() as well.
Make CodeSniffer happy.