ID: 47515 Comment by: kexianbin at diyism dot com Reported By: kexianbin at diyism dot com Status: Open Bug Type: Feature/Change Request Operating System: windows xp PHP Version: 5.3CVS-2009-02-27 (snap) New Comment:
Currently in php 5.3.0RC3 2009.5.15: $fun=function($v){echo $v;}; $fun('hello'); but can not do these: function($v){echo $v;}('hello'); (function($v){echo $v;})('hello'); ($fun=function($v){echo $v;})('hello'); Previous Comments: ------------------------------------------------------------------------ [2009-02-27 01:49:34] kexianbin at diyism dot com Description: ------------ I submit a function request: to make create_function to execute immediately like this: When could we realize this in php? create_function('$v', <<<'nowdoc' echo $v; nowdoc )('hello'); I know i can type thus: $f=create_function('$v', <<<'nowdoc' echo $v; nowdoc ); $f('hello'); even thus: ${!${''}=create_function('$v', <<<'nowdoc' echo $v; nowdoc )}('hello'); but both the 2nd and 3rd are ugly, i need the 1st style. Expected result: ---------------- Show 'hello' Actual result: -------------- Show 'Parse error: parse error' ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47515&edit=1