kennyt          Sat Jan 24 14:20:35 2004 EDT

  Modified files:              
    /phpdoc/en/reference/simplexml      reference.xml 
  Log:
  fixed looping example
  
  
http://cvs.php.net/diff.php/phpdoc/en/reference/simplexml/reference.xml?r1=1.1&r2=1.2&ty=u
Index: phpdoc/en/reference/simplexml/reference.xml
diff -u phpdoc/en/reference/simplexml/reference.xml:1.1 
phpdoc/en/reference/simplexml/reference.xml:1.2
--- phpdoc/en/reference/simplexml/reference.xml:1.1     Fri Jan 23 11:17:17 2004
+++ phpdoc/en/reference/simplexml/reference.xml Sat Jan 24 14:20:35 2004
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.1 $ -->
+<!-- $Revision: 1.2 $ -->
  <reference id="ref.simplexml">
   <title>SimpleXML functions</title>
   <titleabbrev>SimpleXML</titleabbrev>
@@ -36,7 +36,7 @@
     <para>
      <example>
       <title>Include file example.php with XML string</title>
-      <programlisting role="php">
+      <programlisting role="php" id="simplexml.examples.movie">
 <![CDATA[
 <?php
 $xmlstr = <<<XML
@@ -99,14 +99,9 @@
 
 $xml = simplexml_load_string($xmlstr);
 
-/* For each <movie> node, we echo a separate <plot>.
- * [foreach() could be used, but for() stands in place
- *  as using foreach() on large XML documents will
- *  create undesirable memory overhead.] */
-
-$mid_count = count($movies);
-for($mid = 0; $mid < $mid_count; ++$mid) {
-    echo $movies[$mid]->plot,'<br/>';
+/* For each <movie> node, we echo a separate <plot>. */
+foreach($xml->movie as $movie) {
+   echo $movie->plot,'<br/>';
 }
 
 ?>

Reply via email to