I have the following XML array:
["link"]=>
array(2) {
[0]=>
object(SimpleXMLElement)#311 (1) {
["@attributes"]=>
array(3) {
["type"]=>
string(9) "text/html"
["href"]=>
string(48) "http://twitter.com/bob/statuses/1226112723"
["rel"]=>
string(9) "alternate"
}
}
[1]=>
object(SimpleXMLElement)#312 (1) {
["@attributes"]=>
array(3) {
["type"]=>
string(9) "image/png"
["href"]=>
string(59) "http://a3.twimg.com/profile_images/226895523/Dan_normal.png"
["rel"]=>
string(5) "image"
}
}
}
It’s inside a bigger array, I need to get the first and second hef attribute seperatly so that I can put one href as a <a> link and another with a <img>.
How can I output each href rather than both together?
Currently trying this:
foreach($entry->link as $link) {
echo $link->attributes()->href;
}
(currently) prints
But you might also be interested in xsl(t)