Monday 29 June 2009
Facebook StumbleUpon Twitter Google+ Pin It

Access SimpleXMLElement Object Attributes

PHP simplexml_load_string is a simple way to extract xml data into an object. If you have the following result from calling

$obj = simplexml_load_string($xml);
SimpleXMLElement Object
([@attributes] => Array
([status] => success)
[auth] => SimpleXMLElement Object
([token] => dxoYGmwncmntH07jJGro5h0rxNfE2Ni6
[seq] => 33)
)
you can access status by

$obj->attributes()->status


Parthiv Patel
Bhaishri Info Solution
Sr. PHP Developer
Limdi Chowk, AT PO. Nar, Di. Anand
Nar, Gujarat
388150
India
pparthiv2412@gmail.com
7383343029
DOB: 12/24/1986

No comments: