1--TEST--
2Closure 004: Lambda with lexical variables (scope lifetime)
3--FILE--
4<?php
5
6function run () {
7    $x = 4;
8
9    $lambda1 = function () use ($x) {
10        echo "$x\n";
11    };
12
13    $lambda2 = function () use (&$x) {
14        echo "$x\n";
15        $x++;
16    };
17
18    return array($lambda1, $lambda2);
19}
20
21list ($lambda1, $lambda2) = run();
22
23$lambda1();
24$lambda2();
25$lambda1();
26$lambda2();
27
28echo "Done\n";
29?>
30--EXPECT--
314
324
334
345
35Done
36