Access @attributes Nodes in SimpleXML Objects

January 5th, 2010 | Posted in PHP
0

To access the [@attributes] in a SimpleXML object use the following code:

$xml = simplexml_load_string($curl_result, 'SimpleXMLElement', LIBXML_NOCDATA);

foreach ($xml->item as $f)
{
    echo $f->attributes()->id . '<br />';
}

Related posts

Leave a Reply