Req #47515 [Opn->Csd]: make create_function to execute immediately
| From: | nikic@php.net | Date: | Sun, 12 Oct 2014 14:44:12 +0000 |
| Subject: | Req #47515 [Opn->Csd]: make create_function to execute immediately | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-188034@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=47515&edit=1
ID: 47515
Updated by: nikic@php.net
Reported by: kexianbin at diyism dot com
Summary: make create_function to execute immediately
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: Scripting Engine problem
Operating System: windows xp
PHP Version: 5.3.1
-Assigned To:
+Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
Supported in PHP 7.
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-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 https://bugs.php.net/bug.php?id=47515&edit=1