Doc #61857 [Csd]: Extra clarification around closures required
| From: | salathe@php.net | Date: | Tue, 18 Nov 2014 11:03:15 +0000 |
| Subject: | Doc #61857 [Csd]: Extra clarification around closures required | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-11652@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61857&edit=1
ID: 61857
Updated by: salathe@php.net
Reported by: jon at sprig dot gs
Summary: Extra clarification around closures required
Status: Closed
Type: Documentation Problem
Package: Documentation problem
Operating System: Irrelevant
PHP Version: 5.3.11
Assigned To: salathe
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
Previous Comments:
------------------------------------------------------------------------
[2014-11-18 11:02:26] salathe@php.net
Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&revision=335191
Log: Basic closure examples (doc bug #61857)
------------------------------------------------------------------------
[2014-02-01 13:32:59] salathe@php.net
I agree with the bug reporter, perhaps an extra intermediary example could be added showing
super-simple cases of closing over variables.
------------------------------------------------------------------------
[2014-02-01 10:36:19] krakjoe@php.net
I'm not able to see what the documentation looked like for 5.3, having reviewed the
documentation of today, I do not see a problem in the description or any of the examples provided.
So, I'm going to close the bug.
Feel free to report a new bug, for a supported, stable version of PHP, if the information is still
not satisfactory in some way.
Thanks for taking the time to make PHP better :)
------------------------------------------------------------------------
[2012-04-26 14:25:18] jon at sprig dot gs
Errr, oops, that was supposed to show
$closurefunction("hello"); // You may expect "hello town", but it will return
"hello world" still because the use ($vars) is as per when it is defined, not when it is
called.
------------------------------------------------------------------------
[2012-04-26 14:11:09] jon at sprig dot gs
I should add, having just seen something on StackOverflow, there should be another case to list in
that example:
<?php
$external = 'world';
$closurefunction = function ($internal) use ($external) {
echo $internal . ' ' . $external . "\r\n";
}
$external = 'town';
$closurefunction("hello"); // Will return "hello town"
?>
I don't know if this is indeed the case, but that's what the comment here: http://stackoverflow.com/questions/1065188/in-php-5-3-0-what-is-the-function-use-identifier-should-a-sane-programmer-us#comment885456_1066219
suggests
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=61857
--
Edit this bug report at https://bugs.php.net/bug.php?id=61857&edit=1