Edit report at https://bugs.php.net/bug.php?id=55078&edit=1
ID: 55078 Comment by: nickmokisasian at gmail dot com Reported by: charlie at charliesomerville dot com Summary: Can't use anonymous function inside array declaration inside a class Status: Open Type: Feature/Change Request Package: Scripting Engine problem PHP Version: 5.3.6 Block user comment: N Private report: N New Comment: When will this feature be supported? Previous Comments: ------------------------------------------------------------------------ [2011-07-01 18:46:57] fel...@php.net This is just more one limitation, not a bug. Changing to feature request. Thanks. ------------------------------------------------------------------------ [2011-06-29 23:54:37] charlie at charliesomerville dot com Description: ------------ You can't declare an anonymous function in an array declaration inside a class declaration. Test script: --------------- <?php class Foo { static $array = array("hi" => function() { phpinfo(); }); } Foo::$array["hi"](); Expected result: ---------------- phpinfo being displayed Actual result: -------------- Parse error: syntax error, unexpected T_FUNCTION in /path/to/script.php on line 5 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55078&edit=1