Download src/php/php-src/Zend/tests/closures/closure_008.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 459 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/closures/closure_008.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/closures/closure_008.phpt
-
curl -L -o closure_008.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/closures/closure_008.phpt
459 Bytes
| --TEST-- | |
| Closure 008: Use in preg_replace_callback() | |
| --FILE-- | |
| function replace_spaces($text) { | |
| $lambda = function ($matches) { | |
| return str_replace(' ', ' ', $matches[1]).' '; | |
| }; | |
| return preg_replace_callback('/( +) /', $lambda, $text); | |
| } | |
| echo replace_spaces("1 2 3\n"); | |
| echo replace_spaces("1 2 3\n"); | |
| echo replace_spaces("1 2 3\n"); | |
| echo "Done\n"; | |
| --EXPECT-- | |
| 1 2 3 | |
| 1 2 3 | |
| 1 2 3 | |
| Done | |