# SimpleXML bug

- Thread: https://externals.io/message/4379
- Original archive: https://news-web.php.net/php.internals/4379
- Started by Sebastian Bergmann on 2003-09-04T16:24:51+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #4379 — Sebastian Bergmann — 2003-09-04T16:24:51+00:00

URL: https://externals.io/message/4379#4379

The following script

    <?php
    $root = simplexml_load_string('
    <root>
      <child />
    </root>
    ');

    foreach ($root->child as $child) {
        var_dump($child);
    }
    ?>

  does not print anything while

    <?php
    $root = simplexml_load_string('
    <root>
      <child />
      <child />
    </root>
    ');

    foreach ($root->child as $child) {
        var_dump($child);
    }
    ?>

  correctly prints

    object(simplexml_element)#2 (0) {
    }
    object(simplexml_element)#3 (0) {
    }

-- 
Sebastian Bergmann
http://sebastian-bergmann.de/                   http://phpOpenTracker.de/

Das Buch zu PHP 5: http://professionelle-softwareentwicklung-mit-php5.de/
