php - Accessing certain properties of a SimpleXMLElement Object -
php - Accessing certain properties of a SimpleXMLElement Object -
when print_r() simplexmlelement object referenced variable $xmlobject, see next structure:
simplexmlelement object ( [@attributes] => array ( [uri] => /example ) [result] => simplexmlelement object ( [message] => record(s) added [recorddetail] => array ( [0] => simplexmlelement object ... ) ) ) notice how $xmlobject->result->message property looks string. however, if print_r($xmlobject->result->message), following:
simplexmlelement object ( [0] => record(s) added ) so @ point i'm confused. why $xmlobject->result->message beingness identified instance of simplexmlelement object in case, when result of printing total $xmlobject doesn't suggest this?
and how access value? i've tried $xmlobject->result->message[0], prints out same thing (i.e. lastly code snippet posted).
the representation when using print_r or var_dump on simplexmlelement has little how structured internally. instance there no property @attributes access $element['@attributes']['uri'] either. $element['uri']
this way is. simplexmlelement objects behave different. create sure read examples in php manual before using simplexml:
to understand implementation in detail, you'd have @ source code:
http://lxr.php.net/opengrok/xref/php_trunk/ext/simplexml/simplexml.cto print $xmlobject->result->message echo $xmlobject->result->message. autocast simplexmlelement string.
php xml simplexml
Comments
Post a Comment