note 92003 added to functions.anonymous
| From: | nash at nashweb dot de | Date: | Sat, 04 Jul 2009 15:41:37 +0000 |
| Subject: | note 92003 added to functions.anonymous | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-157916@lists.php.net to get a copy of this message | ||
This works:
<?php
function returnsAFunc()
{
print "returns A Func called";
return function()
{
print "within return val";
};
}
$x = returnsAFunc();
$x();
?>
This does NOT work:
<?php
function returnsAFunc()
{
print "returns A Func called";
return function()
{
print "within return val";
};
}
returnsAFunc()(); // parse error
?>
(Using PHP 5.3)
----
Server IP: 212.124.37.9
Probable Submitter: 91.13.177.144
----
Manual Page -- http://www.php.net/manual/en/functions.anonymous.php
Edit -- https://master.php.net/note/edit/92003
Del: integrated -- https://master.php.net/note/delete/92003/integrated
Del: useless -- https://master.php.net/note/delete/92003/useless
Del: bad code -- https://master.php.net/note/delete/92003/bad+code
Del: spam -- https://master.php.net/note/delete/92003/spam
Del: non-english -- https://master.php.net/note/delete/92003/non-english
Del: in docs -- https://master.php.net/note/delete/92003/in+docs
Del: other reasons-- https://master.php.net/note/delete/92003
Reject -- https://master.php.net/note/reject/92003
Search -- https://master.php.net/manage/user-notes.php