开发者

How do I get my values out of their SimpleXMLObjects?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜