note 118179 added to functions.anonymous
| From: | ChakibDohsset | Date: | Wed, 21 Oct 2015 10:27:09 +0000 |
| Subject: | note 118179 added to functions.anonymous | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-203997@lists.php.net to get a copy of this message | ||
Notice : in entire of Example #3 Inheriting variables from the parent scope
You don't need to add echo before $exemple() it contain var_dump and it is enough for printing
the result
<?php
$message = 'hello';
// Inherit $message
$example = function () use($message) {
var_dump($message);
};
echo $example(); // hello
?>
no need for echo
<?php
$message = 'hello';
// Inherit $message
$example = function () use($message) {
var_dump($message);
};
$example();// hello
?>
----
Server IP: 72.52.91.14
Probable Submitter: 197.206.60.203
----
Manual Page -- http://php.net/manual/en/functions.anonymous.php
Edit -- https://master.php.net/note/edit/118179
Del: integrated -- https://master.php.net/note/delete/118179/integrated
Del: useless -- https://master.php.net/note/delete/118179/useless
Del: bad code -- https://master.php.net/note/delete/118179/bad+code
Del: spam -- https://master.php.net/note/delete/118179/spam
Del: non-english -- https://master.php.net/note/delete/118179/non-english
Del: in docs -- https://master.php.net/note/delete/118179/in+docs
Del: other reasons-- https://master.php.net/note/delete/118179
Reject -- https://master.php.net/note/reject/118179
Search -- https://master.php.net/manage/user-notes.php