Say I have a variable called $myXMLElement and when I dump the variable it looks like this.
SimpleXMLElement Object (
[@attributes] => Array ( [id] => 7 )
[0] => Kirkpatrick
)
How do I grab the value of Kirkpatrick in PHP
Have you tried:
(string) $var[0]
? Normally you do that with string casting, will turn SimpleXMLElements into the XML nodeValue.
这应该获得值:
echo $myXMLElement->{'0'};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.