foreach ($pie->select(array("id")) as $n => $id) { $ids[] = $id['id']; } foreach ($data['statuses'] as $n => $tweet) { if (!isset($tweet['retweeted_status'])) { //-- Check for duplicate if (!in_array($tweet['id'], $ids, true) || isset($_GET['first'])) { $output = array(); $output['text'] = $tweet['text']; $output['user'] = $tweet['user']['screen_name']; $output['avatar'] = $tweet['user']['profile_image_url']; $output['date'] = strtotime($tweet['created_at']); $tweets[] = $output; //-- Store ID, so we don't double show $datas = array("id" => $tweet['id']); $pie->add($datas); } } } //-- Need to reverse the order of the tweets - fanks TWITTOR if (count($tweets) > 0) { usort($tweets, function ($a, $b) { return $a['date'] - $b['date']; }); } //-- Add to main array $main['tweets'] = $tweets; /* Speaker Array Organised into tracks (as arrays) so that the system can grab them based on the timestart and timeend. */