Annotation of embedaddon/php/Zend/tests/closure_007.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Closure 007: Nested lambdas in classes
3: --FILE--
4: <?php
5:
6: class A {
7: private $x = 0;
8:
9: function getClosureGetter () {
10: return function () {
11: return function () {
12: $this->x++;
13: };
14: };
15: }
16:
17: function printX () {
18: echo $this->x."\n";
19: }
20: }
21:
22: $a = new A;
23: $a->printX();
24: $getClosure = $a->getClosureGetter();
25: $a->printX();
26: $closure = $getClosure();
27: $a->printX();
28: $closure();
29: $a->printX();
30:
31: echo "Done\n";
32: ?>
33: --EXPECT--
34: 0
35: 0
36: 0
37: 1
38: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>