ID: 27139 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Bogus Bug Type: *XML functions PHP Version: 5CVS-2004-02-03 (dev) New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php As Adam said, use foreach. Previous Comments: ------------------------------------------------------------------------ [2004-02-03 23:55:32] adam at trachtenberg dot com No. You need to use foreach() or the iterator magic won't work. ------------------------------------------------------------------------ [2004-02-03 22:16:05] [EMAIL PROTECTED] Description: ------------ We should be able to use normal array iteration techniques when going through such pseudoarray structures in simplexml elements, right? Reproduce code: --------------- $xml = simplexml_load_string( '<a> <b></b> <b></b> <b></b> </a>'); while(list($foo, $bar) = each($xml->b)) { echo '"' , $foo , '" - "', $bar , '"' , chr(10); } --OR-- for($i = 0; $i < count($xml->b); ++$i) { echo '"' , $i , '" - "', $xml->b[$i] , '"' , chr(10); } Expected result: ---------------- [3 lines of output] --OR-- "0" - "" "1" - "" "2" - "" Actual result: -------------- [no output] --OR-- "0" - "" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27139&edit=1