fixed looping example

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@149633 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Ken 2004-01-24 19:20:35 +00:00
parent f3b95bb58b
commit d83d498490

View file

@ -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 @@ include 'example.php';
$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/>';
}
?>