Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Assuming your missing <code>&lt;/contents&gt;</code> is placed as below:</p> <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0"?&gt; &lt;settings&gt; &lt;contents&gt; &lt;content&gt; &lt;item&gt;a&lt;/item&gt; &lt;title&gt;A&lt;/title&gt; &lt;keywords&gt;&lt;/keywords&gt; &lt;/content&gt; &lt;content&gt; &lt;item&gt;b&lt;/item&gt; &lt;title&gt;B&lt;/title&gt; &lt;keywords&gt;&lt;/keywords&gt; &lt;/content&gt; &lt;content&gt; &lt;item&gt;c&lt;/item&gt; &lt;title&gt;C&lt;/title&gt; &lt;keywords&gt;&lt;/keywords&gt; &lt;/content&gt; &lt;/contents&gt; &lt;!-- missing --&gt; &lt;errors_escape&gt; &lt;error_escape&gt;one&lt;/error_escape&gt; &lt;error_escape&gt;two&lt;/error_escape&gt; &lt;error_escape&gt;three&lt;/error_escape&gt; &lt;/errors_escape&gt; &lt;/settings&gt; </code></pre> <p>You can do something like this:</p> <pre class="lang-php prettyprint-override"><code>$this-&gt;all_settings=array(); $this-&gt;error_escape=array(); foreach($this-&gt;xml_file-&gt;contents-&gt;content as $node) { $this-&gt;all_settings[]=array("item"=&gt;strval($node-&gt;item),"title"=&gt;strval($node-&gt;title),"keywords"=&gt;strval($node-&gt;keywords)); } foreach($this-&gt;xml_file-&gt;errors_escape-&gt;error_escape as $node) { $this-&gt;error_escape[]=strval($node); } //print_r($this-&gt;all_settings); //print_r($this-&gt;error_escape); </code></pre> <p><a href="http://3v4l.org/MutNG" rel="nofollow">Online demo</a></p> <p>The two debug <code>print_r</code> outputs:</p> <pre class="lang-none prettyprint-override"><code>Array ( [0] =&gt; Array ( [item] =&gt; a [title] =&gt; A [keywords] =&gt; ) [1] =&gt; Array ( [item] =&gt; b [title] =&gt; B [keywords] =&gt; ) [2] =&gt; Array ( [item] =&gt; c [title] =&gt; C [keywords] =&gt; ) ) Array ( [0] =&gt; one [1] =&gt; two [2] =&gt; three ) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload