|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-02-27 01:49 UTC] 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'
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 02 15:00:01 2025 UTC |
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');