I am experimenting with arrays and I haven't really 'gotten it' quite yet. I am trying to pull data from an XML and display specific data from an array as a php variable.
$xml = simplexml_load_string($result);
print_r($xml->query_responses->query_response->us_market_data->common_us_data->basic_data->year);
Gives me the exact data that I am looking for however the results are:
SimpleXMLElement Object ( [0] => 2011 )
How can I display just the year 2011??? I'd like it set as a variable so that I can wrap some HTML around it....something like:
<h2>The year of this is <? print "$xml[year]";?> </h2>
I know this should be easy but I cant seem to figure it out.
Many thanks in advance.