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 8638193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:39:59+00:00 2026-06-12T10:39:59+00:00

How do I combine two different datas from Facebook and Twitter. And sort them

  • 0

How do I combine two different datas from Facebook and Twitter. And sort them by created_time in PHP??

Supposedly I already got the two datas from their respective API calls. But I can’t seem to figure out how to combine them and sort them properly.

Example :

FB[1] TW[1]
FB[2] TW[2]
FB[3] TW[3]

If FB[1]’s created_time is much earlier than of TW[1], then FB[1] is ahead of TW[1].
If FB[2]’s created_time is later than of TW[2], then FB[2] is behind of TW[1].
If FB[3]’s created_time is the same as of TW[3], then the post would be from FB first then TW.

I got this pseudocode stuck in my head, I just can’t figure out how to sort it.

I need this for my project. Please Help.

EDIT: I am using CodeIgniter.. 🙂

  • 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-06-12T10:40:01+00:00Added an answer on June 12, 2026 at 10:40 am

    I don’t know which kind of data do you retrieved from fb and tw, but it should be something like this if both are numeric indexed, and the next dimension has the created_time field:

    function cbSort($a, $b) {
       return $a['created_time]>$b['created_time'];
    }
    
    $res=array_merge($fb, $tw);
    usort($res, 'cbSort');    
    var_dump($res);
    

    Anyway in what you are trying to acomplish the best option would be to normalize the posts to a generic custom class.

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

Sidebar

Related Questions

I have data from two different sources that I need to combine. Some data
I'm trying to combine info from two different logs into a single query, but
I would like to combine the DisplayNames from two different ViewModels, but only IF
I want to combine two ggplots, from two different data.frames, into one plot. Below
I am trying to combine the odds ratios outputted from two models with different
I saw that even by writing separate commands, we can combine two different types
I'm trying to come up with a way combine two arrays that have different
There is a requirement to load a list of items(ArrayList) from two different tables.
I have two complex rails (AR) queries coming from two different methods that I
I have two tables from two different databases. For example: Table: Articles1 - Database:

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.