ID:          27139
 Comment by:  adam at trachtenberg dot com
 Reported By: [EMAIL PROTECTED]
 Status:      Open
 Bug Type:    *XML functions
 PHP Version: 5CVS-2004-02-03 (dev)
 New Comment:

No. You need to use foreach() or the iterator magic 
won't work.


Previous Comments:
------------------------------------------------------------------------

[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

Reply via email to