Last active
April 9, 2019 17:12
-
-
Save vbarbarosh/b2f418c2bac94e63e8a4feeb03a745f1 to your computer and use it in GitHub Desktop.
php_function_scope – Use a function as an scope for variables https://codescreens.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| # Use a function as an scope for variables | |
| $foo = call_user_func(function () { | |
| $aa = 'Fusce vitae orci lorem.'; | |
| $bb = 'In cursus nisi malesuada.'; | |
| $cc = 'Etiam auctor, lectus eu lacinia condimentum.'; | |
| return implode("\n", [$aa, $bb, $cc]); | |
| }); | |
| var_dump(get_defined_vars()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment