Edit report at https://bugs.php.net/bug.php?id=62386&edit=1

 ID:                 62386
 Comment by:         reeze dot xia at gmail dot com
 Reported by:        Daniel dot L dot Nill at gmail dot com
 Summary:            Closures require arguments in function header
 Status:             Open
 Type:               Feature/Change Request
 Package:            Unknown/Other Function
 Operating System:   linux
 PHP Version:        5.3Git-2012-06-21 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

It's a function but not a class.
We have to use ()to call it


Previous Comments:
------------------------------------------------------------------------
[2012-06-22 00:35:10] Daniel dot L dot Nill at gmail dot com

Description:
------------
There seems to be no reason for this throwing an error, but if I try to 
instantiate an anonymous function that does not have any arguments then I get 
an 
'Parse error'.  This breaks a lot of closure functionality that could exist.

Test script:
---------------
$anonymous_function = function(){
    echo "hello world<br/>";
};

$anonymous_function();
$anonymous_function;

Expected result:
----------------
hello world
hello world

Actual result:
--------------
Parse error: syntax error, unexpected T_FUNCTION in /index.php(192) : eval()'d 
code on line 1


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62386&edit=1

Reply via email to