xref: /PHP-7.4/Zend/tests/closure_002.phpt (revision d5ef2f46)
1--TEST--
2Closure 002: Lambda with lexical variables (global scope)
3--FILE--
4<?php
5
6$x = 4;
7
8$lambda1 = function () use ($x) {
9	echo "$x\n";
10};
11
12$lambda2 = function () use (&$x) {
13	echo "$x\n";
14};
15
16$lambda1();
17$lambda2();
18$x++;
19$lambda1();
20$lambda2();
21
22echo "Done\n";
23?>
24--EXPECT--
254
264
274
285
29Done
30