I cannot figure out a way to cut this down to one loop. The processing in each loop is identical. I’d show what I’ve tried but I can’t even get my head around what to try.
<?
if($xml->entry){
foreach ($xml->entry as $item) {
...
}
else{
foreach($rss->channel->item as $item) {
...
}
}
>Solution :
foreach (($xml->entry ? $xml->entry : $rss->channel->item) as $item) {
...
}