ID:               47515
 User updated 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)
+PHP Version:      5.3.0
 New Comment:

Any change?


Previous Comments:
------------------------------------------------------------------------

[2009-05-15 05:21:49] kexianbin at diyism dot com

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');

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

[2009-05-15 05:20:56] kexianbin at diyism dot com

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');

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

[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

Reply via email to