Download src/php/php-src/Zend/tests/closures/closure_009.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 374 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/closures/closure_009.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/closures/closure_009.phpt
-
curl -L -o closure_009.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/closures/closure_009.phpt
374 Bytes
| --TEST-- | |
| Closure 009: Using static vars inside lambda | |
| --FILE-- | |
| $a = 1; | |
| $x = function ($x) use ($a) { | |
| static $n = 0; | |
| $n++; | |
| $a = $n.':'.$a; | |
| echo $x.':'.$a."\n"; | |
| }; | |
| $y = function ($x) use (&$a) { | |
| static $n = 0; | |
| $n++; | |
| $a = $n.':'.$a; | |
| echo $x.':'.$a."\n"; | |
| }; | |
| $x(1); | |
| $x(2); | |
| $x(3); | |
| $y(4); | |
| $y(5); | |
| $y(6); | |
| --EXPECT-- | |
| 1:1:1 | |
| 2:2:1 | |
| 3:3:1 | |
| 4:1:1 | |
| 5:2:1:1 | |
| 6:3:2:1:1 | |