You are here: Sorting multiple XML data by date « PHP Programming Language « IT news, forums, messages
Sorting multiple XML data by date

Posted by junkmate on 08/15/07 04:08

I am making an RSS parser that takes multiple XML inputs in to an
array and then sorts them by their date value... and it 'almost'
works... I always lose the top value of the second rss feed to be
parsed... its pretty annoying as this is often the most recently
updated RSS item that is missing from my multi-feed...

Help me please:


Currently, I am doing this:

usort($xmlreader_parsed_data, "rss_cmp");

which calls this function:

function rss_cmp($a, $b)
{
$a = strtotime($a->date);
$b = strtotime($b->date);

if ($a == $b) {
return 0;
}
return ($a > $b) ? -1 : 1;
}

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация