Download src/php/php-src/Zend/tests/foreach/bug40705.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 405 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/foreach/bug40705.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/foreach/bug40705.phpt
-
curl -L -o bug40705.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/foreach/bug40705.phpt
405 Bytes
| --TEST-- | |
| Bug #40705 (Iterating within function moves original array pointer) | |
| --FILE-- | |
| function doForeach($array) | |
| { | |
| foreach ($array as $k => $v) { | |
| // do stuff | |
| } | |
| } | |
| $foo = array('foo', 'bar', 'baz'); | |
| var_dump(key($foo)); | |
| doForeach($foo); | |
| var_dump(key($foo)); | |
| foreach ($foo as $k => $v) { | |
| var_dump($k); | |
| } | |
| var_dump(key($foo)); | |
| --EXPECT-- | |
| int(0) | |
| int(0) | |
| int(0) | |
| int(1) | |
| int(2) | |
| int(0) | |