<settings>
<one type="gui" subtype="fullscreen">true</one>
<two type="gui" subtype="alphablend">255</two>
</settings>
Array
(
[one] => Array
(
'type' => 'gui',
'subtype' => 'fullscreen',
'value' => 'true'
)
[two] => Array
(
'type' => 'gui',
'subtype' => 'alphablend',
'value' => '255'
)
)
c("Form1")->alphaBlendValue = $setting['two']['value'];
$data = <<<XML
<settings>
<one type="gui" subtype="fullscreen">true</one>
<two type="gui" subtype="alphablend">255</two>
</settings>
XML;
function parse_xml($data)
{
$result = [];
$xml = simplexml_load_string($data);
/** @var SimpleXMLElement $node */
foreach ($xml as $key => $node) {
$value = [];
foreach ($node->attributes() as $k => $v) {
$value[$k] = (string) $v;
}
$value['value'] = (string) $node;
$result[$key] = $value;
}
return $result;
}
var_dump(parse_xml($data));
array(2) {
'one' =>
array(3) {
'type' =>
string(3) "gui"
'subtype' =>
string(10) "fullscreen"
'value' =>
string(4) "true"
}
'two' =>
array(3) {
'type' =>
string(3) "gui"
'subtype' =>
string(10) "alphablend"
'value' =>
string(3) "255"
}
}