开发者

Get pure value from an object

开发者 https://www.devze.com 2023-01-29 17:56 出处:网络
Anyone know how could i get the pure value out of this kind of object: SimpleXMLElement Object 开发者_运维百科(

Anyone know how could i get the pure value out of this kind of object:

SimpleXMLElement Object
开发者_运维百科(
    [0] => 13863
)

Not matter what i did, i can not get the pure value from this object. Any advise would be helpful.


apply type casting like (int) $xml->your_node_name

details: http://php.net/manual/en/language.oop5.typehinting.php


Try this:

$value = $object->{0}

Curly braces are often useful for accessing awkwardly-named properties on objects, particularly in the context of XML.

0

精彩评论

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