开发者

php simplexml get object variable start with number

When I parse an rss file with SimpleXMLElement, I get this object :

object(SimpleXMLElemen开发者_如何学编程t)#307 (1) {
  [0]=>
  string(39) "http://workspace/wordpress/hello-world/"
}

$var->0 doesn't works.

I don't know how to do it :(

thanks.


It behaves like an array

echo $var[0];

In this case - when there's only one (child) element - you don't even have to use the index

echo $var;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜