Zeev seems to be working on foreach and simplexml, but the above
behaviour is the correct one.  Why should the first loop?  If I did:

<?php
foreach ("hello" as $world) {
        var_dump($world);
}
?>

what would i get?

-Sterling

On Thu, 2003-09-04 at 18:24, Sebastian Bergmann wrote:
>   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/
-- 
If a 6600 used paper tape instead of core memory, it would use up tape 
at about 30 miles/second. 
  - Grishman, Assembly Language Programming

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to