Download src/php/php-src/Zend/tests/foreach/bug76800.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 395 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/foreach/bug76800.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/foreach/bug76800.phpt
-
curl -L -o bug76800.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/foreach/bug76800.phpt
395 Bytes
| --TEST-- | |
| Bug #76800 (foreach inconsistent if array modified during loop) | |
| --FILE-- | |
| $arr = [1 => 1, 3 => 3]; // [1 => 1, 2 => 3] will print both keys | |
| foreach($arr as $key => &$val) { // without & will print both keys | |
| echo "See key {$key}\n"; | |
| $arr[0] = 0; // without this line will print both keys | |
| unset($arr[0]); | |
| } | |
| --EXPECT-- | |
| See key 1 | |
| See key 3 | |