Req #12405 [Opn->Csd]: The result of create_function should be accepable to the parser
| From: | jani@php.net | Date: | Tue, 14 Dec 2010 10:51:40 +0000 |
| Subject: | Req #12405 [Opn->Csd]: The result of create_function should be accepable to the parser | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-156986@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=12405&edit=1
ID: 12405
Updated by: jani@php.net
Reported by: ben-php at bacarisse dot btinternet dot co dot uk
Summary: The result of create_function should be accepable to
the parser
-Status: Open
+Status: Closed
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: Linux (but I think all)
PHP Version: 4.0.6
-Assigned To:
+Assigned To: jani
Block user comment: N
Private report: N
New Comment:
We have closures now since PHP 5.3.0
Previous Comments:
------------------------------------------------------------------------
[2001-07-26 13:14:56] ben-php at bacarisse dot btinternet dot co dot uk
While trying to build a set of higher-order search and
match functions, I came across the "null at the front of
the lambda name" refered to in bug #10721.
It would ne very neat if one could write:
function _not_($f) {
return create_function('$x', "return !$f(\$x);");
}
and so on for _and_ and _or_(with two function args).
Once a set of primitive match functions are defined you
can then define complex criteria. However, the parser
rejects the names produced create_function.
The following works but it clearly yucky:
function f_not($f) {
$f = substr($f, 1);
return create_function('$x',
"return !call_user_func(chr(0).'$f', \$x);");
}
For these lambdas to be true closures, they should be
callable from other created functions.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=12405&edit=1