Download src/php/php-src/Zend/tests/closures/closure_007.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 502 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/closures/closure_007.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/closures/closure_007.phpt
-
curl -L -o closure_007.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/closures/closure_007.phpt
502 Bytes
| --TEST-- | |
| Closure 007: Nested lambdas in classes | |
| --FILE-- | |
| 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 | |