note 118179 deleted from functions.anonymous by cmb
| From: | cmb@php.net | Date: | Wed, 16 Dec 2015 15:46:34 +0000 |
| Subject: | note 118179 deleted from functions.anonymous by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-204409@lists.php.net to get a copy of this message | ||
Note Submitter: Chakib Dohsset
----
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
?>