Note that there are some explanatory texts on larger screens.

plurals
  1. POparsing xml file won't work
    primarykey
    data
    text
    <p>I have an object constructor which uses an xmlfile to set the properties of the method. The constructor accesses it by</p> <pre><code>$this-&gt;xml_file = simplexml_load_file('xml/settings.xml'); </code></pre> <p>This is how the xml file looks like:</p> <pre><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;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>I'd like to create two arrays with this information. The should look like:</p> <pre><code>protected $all_settings = array( array('item' =&gt; 'a', 'title' =&gt; 'A', 'keywords' =&gt; ''), array('item' =&gt; 'b', 'title' =&gt; 'B', 'keywords' =&gt; ''), array('item' =&gt; 'c', 'title' =&gt; 'C', 'keywords' =&gt; ''), ); protected $errors_escape = array('one', 'two', 'three'); </code></pre> <p>I've tried and read different questions on this topic, but I can't do anything but create arrays where it says</p> <pre><code>[title] =&gt; SimpleXMLElement Object ( [0] =&gt; A ) </code></pre> <p>or </p> <pre><code>[title] =&gt; SimpleXMLElement Object ( ) </code></pre>
    singulars
    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.
    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