blob: 89cd06d8a134c96ce5e7e3f8fa9b44bd3524ee62 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
--TEST--
Closure 007: Nested lambdas in classes
--FILE--
<?php
class A {
private $x = 0;
function getClosureGetter () {
return function () {
return function () {
$this->x++;
};
};
}
function printX () {
echo $this->x."\n";
}
}
$a = new A;
$a->printX();
$getClosure = $a->getClosureGetter();
$a->printX();
$closure = $getClosure();
$a->printX();
$closure();
$a->printX();
echo "Done\n";
?>
--EXPECT--
0
0
0
1
Done
|