I have an object constructor which uses an xmlfile to set the properties of the method. The constructor accesses it by
$this->xml_file = simplexml_load_file('xml/settings.xml');
This is how the xml file looks like:
<?xml version="1.0"?>
<settings>
<contents>
<content>
<item>a</item>
<title>A</title>
<keywords></keywords>
</content>
<content>
<item>b</item>
<title>B</title>
<keywords></keywords>
</content>
<content>
<item>c</item>
<title>C</title>
<keywords></keywords>
</content>
<errors_escape>
<error_escape>one</error_escape>
<error_escape>two</error_escape>
<error_escape>three</error_escape>
</errors_escape>
</settings>
I'd like to create two arrays with this information. The should look like:
protected $all_settings = array(
array('item' => 'a', 'title' => 'A', 'keywords' => ''),
array('item' => 'b', 'title' => 'B', 'keywords' => ''),
array('item' => 'c', 'title' => 'C', 'keywords' => ''),
);
protected $errors_escape = array('one', 'two', 'three');
I've tried and read different questions on this topic, but I can't do anything but create arrays where it says
[title] => SimpleXMLElement Object
(
[0] => A
)
or
[title] => SimpleXMLElement Object
(
)