Possible Duplicate:
Workaround for basic syntax not being parsed
Why don't PHP attributes allow functions?
我得到了
Parse error: syntax error, unexpected T_FUNCTION in /home/codemonkey/dev/broadnet/bito.api2/broadnet/resources/broadmapresource.php on line 87
来自这段代码:
private $debugFunctions = array(
"testing" => function() // Line 87
{
return "I'm a test function!";
},
"foo" => function()
{
return "bar";
}
);
我的印象是我可以在任何可以使用 $variables
的地方使用匿名 PHP 函数。这是异常,还是我做错了什么?
我正在使用 PHP 5.3.9