I have a multidimensional xml array that stores data for the page i am requesting. I am then using xpath to get each attribute in the array:
$Title = $xml->xpath("//data[@key='Title']");
This works fine, I can echo the sibling key 'value' using $Title[0]['value'] but is there a better way of doing this; so i dont have to remember to call it like this?
The array looks like:
array(1) {
[0]=>
object(SimpleXMLElement)#5 (1) {
["@attributes"]=>
array(5) {
["key"]=>
string(5) "Title"
["value"]=>
string(12) "Test Event 2"
["inputType"]=>
string(4) "Text"
["inputName"]=>
string(8) "txtTitle"
["id"]=>
string(2) "77"
}
}
}
Thanks