I need to echo the key value of an array.
This is how im outputting my array:
foreach($xml->channel->item as $item) {
$item->title
}
I've tried adding:
foreach($xml->channel->item as $key => $item)
But the value I echo just comes out as: item
Any ideas?
Var Dump of item results:
var_dump($xml->channel->item);
object(SimpleXMLElement)#4 (5) {
["title"]=> string(33) "BA and union agree to end dispute"
["description"]=> string(118) "British Airways and the Unite union reach an agreement which could end the long-running dispute between the two sides."
["link"]=> string(61) "http://www.bbc.co.uk/go/rss/int/news/-/news/business-13373638"
["guid"]=> string(43) "http://www.bbc.co.uk/news/business-13373638"
["pubDate"]=> string(29) "Thu, 12 May 2011 12:33:38 GMT"
}