Download src/php/php-src/ext/simplexml/tests/029.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 534 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/simplexml/tests/029.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/ext/simplexml/tests/029.phpt
-
curl -L -o 029.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/simplexml/tests/029.phpt
534 Bytes
| --TEST-- | |
| SimpleXML: foreach and count | |
| --EXTENSIONS-- | |
| simplexml | |
| --FILE-- | |
| $xml =<<<EOF | |
| <people> | |
| <person name="Joe"/> | |
| <person name="John"> | |
| <children> | |
| <person name="Joe"/> | |
| </children> | |
| </person> | |
| <person name="Jane"/> | |
| </people> | |
| EOF; | |
| $people = simplexml_load_string($xml); | |
| foreach($people as $person) | |
| { | |
| var_dump((string)$person['name']); | |
| var_dump(count($people)); | |
| var_dump(count($person)); | |
| } | |
| --EXPECT-- | |
| string(3) "Joe" | |
| int(3) | |
| int(0) | |
| string(4) "John" | |
| int(3) | |
| int(1) | |
| string(4) "Jane" | |
| int(3) | |
| int(0) | |