在PHP 5.3 以后,添加了闭包这个功能,代码实现如下:
$test = function($str){ echo $str; } $test('hello world'); //输出 hello world