Download src/php/php-src/Zend/tests/arrow_functions/008.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 407 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/arrow_functions/008.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/arrow_functions/008.phpt
-
curl -L -o 008.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/arrow_functions/008.phpt
407 Bytes
| --TEST-- | |
| Yield inside arrow functions | |
| --FILE-- | |
| // This doesn't make terribly much sense, but it works... | |
| $fn = fn() => yield 123; | |
| foreach ($fn() as $val) { | |
| var_dump($val); | |
| } | |
| $fn = fn() => yield from [456, 789]; | |
| foreach ($fn() as $val) { | |
| var_dump($val); | |
| } | |
| $fn = fn() => fn() => yield 987; | |
| foreach ($fn()() as $val) { | |
| var_dump($val); | |
| } | |
| --EXPECT-- | |
| int(123) | |
| int(456) | |
| int(789) | |
| int(987) | |