开发者

How do I get my values out of their SimpleXMLObjects?

开发者 https://www.devze.com 2023-01-16 12:08 出处:网络
Afte开发者_如何学Pythonr an xPath, I\'m left with this var_dump: array(1) { [0]=> object(SimpleXMLElement)#2 (1) {

Afte开发者_如何学Pythonr an xPath, I'm left with this var_dump:

array(1) {
  [0]=>
  object(SimpleXMLElement)#2 (1) {
    [0]=>
    string(11) "22-99586795"
  }
}

echoing the damn thing only gives me "Array()"

How do I get the bloody string out?

Thanks


It's an array with one item, so you need to do:

$myelement[0];

or

$myelement[0][0];

(I can't tell from your question which element you're referring to)


Try casting it to string

print (string)$yourarray[0];
0

精彩评论

暂无评论...
验证码 换一张
取 消