This is a newbie question - how do I access the value0, value1, ... entities?
object(SimpleXMLElement)#43 (2) {
["@attributes"]=>
array(3) {
["ABC"]=>
string(1) 开发者_如何学Go"1"
["DEF"]=>
string(14) "recordXYZ"
["GHI"]=>
string(1) "@"
}
["qwerty"]=>
array(5) {
[0]=>
string(4) "value0"
[1]=>
string(1) "value1"
[2]=>
string(2) "value2"
[3]=>
string(2) "value3"
[4]=>
string(4) "value4"
}
}
Just plain array access
$value0 = $object->qwerty[0]
$value1 = $object->qwerty[1]
When $object
is the SimpleXMLElement object you showed, then $object->qwerty
is the array with your values.
foreach ($object->querty as $val) {
var_dump($val);
}
See the children() function in the SimpleXMLElement documentation for an example.
精彩评论