Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6580231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:59:59+00:00 2026-05-25T15:59:59+00:00

How will I create a function to take an array of tweets from twitter

  • 0

How will I create a function to take an array of tweets from twitter using TwitterOAuth by Abraham Williams, to be able to compare the array of tweets e.g

Tweet A With Tweet B With Tweet C and so on?

require_once('Twitter/twitteroauth/twitteroauth.php');
require_once('Twitter/Twitter_Config.php');

$userTimeline = $connection->get('statuses/user_ti');

function createAnArrayofTweetTimes($timeline)
{
    $tweetTimes = array();

    foreach ($timeline as $tweet) {
        $tweettext = strtolower($tweet->text);
        if (stristr($tweettext, '#edgarsclub')) {
            array_push($tweetTimes, $tweet->created_at);
            array_push($tweetTimes, 1);
            echo $tweet->created_at;
        }
    }
    return $tweetTimes;
}

I want to take this value which will be an array

 $tweetTimes = $createAnArrayofTweetTimes($usertimeline)

And compare each tweet with the next one using the succeeding function.

function tweetTime($x, $y)
{
    //THIS FUNCITON WILL COMPARE TWEETS WITH ONE ANOTHER
    //TAKE PRECEDING TWEET AND COMPARE WITH SUCCEEDING TWEET
    //IF LESS THEN 24 RETURN FALSE

    $currentTime = strtotime($currentTime);
    $tweetTime = strtotime($tweetTime);
    $timeInSeconds = $currentTime - $tweetTime;

    if ($timeInSeconds > 84600) {
        return true;
    } else {
        return false;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:00:00+00:00Added an answer on May 25, 2026 at 4:00 pm

    See below a suggested approach:

    function compareTweets($tweetTimes) {
        for ($i=0; i<count($tweetTimes)-1; $i++) {
            if (tweetTime($tweetTimes[$i], $tweetTimes[$i+1]) {
                //do what you want when the tweet time is more than 24h
            }
            else {
                //do what you want when the tweet time is less than 24h
            }
        }
    }
    

    I hope this helps. If not please post again. Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using CGDataProviderCreateWithData to (eventually) create a UIImage from a malloced array of bytes.
I want to create a function that will take a string and an integer
I'm trying to create a function that will take a string which could be
I would like to create a function that will take as a parameter a
I am looking to create a function in Java that will take in two
I've created a javascript function that will take a hidden span, copy the text
I am new to Prolog and I'm trying to to create function that will
How do I create a function that will close the window after 2 seconds?
I'm trying to create a function in C# which will allow me to, when
I am trying to create a function which will give me alphabet position when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.