ARTICLE AD BOX
Here in my WordPress plugin I am using the following Code to read an xml feed.
$itsw_rss_feed = simplexml_load_file($itsw_feedurls[wp_rand(0,count($itsw_feedurls) - 1)]);then using a for loop I am storing the feed records to an Array.
if (!empty($itsw_rss_feed)) { $i = 0; foreach ($itsw_rss_feed->channel->item as $itsw_feed_item) { if ($i >= 190) break; { $itsw_totalrecords[$i] = [$itsw_feed_item->link, array_slice(explode('<p>', $itsw_feed_item->description), 0)[0], $itsw_feed_item->title, substr(array_slice(explode('<p>', $itsw_feed_item->description), 0)[1], 0, -7)]; } $i ++; }Then applying shuffle() function to randomize the array items.
shuffle($itsw_totalrecords);is there any better solution to shuffle the xml feed without taking it to an array?
