xref: /PHP-8.2/Zend/tests/closure_002.phpt (revision f8d79582)
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