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

  • Home
  • SEARCH
  • 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 4016662
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:46:03+00:00 2026-05-20T09:46:03+00:00

Is there a way I can sort the following array into the correct chronological

  • 0

Is there a way I can sort the following array into the correct chronological order ?

[0] => Array
    (
        [date] => Sat, 12 Feb 2011 16:55:13 -0500
        [title] => Product 1
        [link] => http://blabla/product-1
    )

[1] => Array
    (
        [date] => Sat, 25 Sep 2010 17:52:24 -0400
        [title] => Product 2
        [link] => http://blabla/product-2
    )

[2] => Array
    (
        [date] => Sun, 05 Dec 2010 17:41:32 -0500
        [title] => Product 3
        [link] => http://blabla/product-3
    )

[3] => Array
    (
        [date] => Sun, 28 Nov 2010 09:14:39 -0500
        [title] => Product 4
        [link] => http://blabla/product-4
    )

[4] => Array
    (
        [date] => Tue, 07 Dec 2010 18:43:45 -0500
        [title] => Product 5
        [link] => http://blabla/product-5
    )

The array, from a rss feed, comes to me like this.

I would like to sort the array in chronological order (based on [date] obviously) : Product 1, Product 5, Product 3, Product 4, Product 2

In order to be able to do display the latest products in the real order (not in the strange order they gave me ! – btw, fake products names, the order is really totally random)

Thanks a lot !

  • 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-20T09:46:03+00:00Added an answer on May 20, 2026 at 9:46 am

    Use usort: http://www.phpbuilder.com/manual/function.usort.php

    You write a comparison function that compares two “elements” (in this case, your date strings), and returns the correct order for them.

    Edit: you could use strtotime: http://php.net/manual/en/function.strtotime.php to convert the date string to a timestamp, and then return the comparison of the resulting timestamps.

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

Sidebar

Related Questions

Is there a better way to shell sort using C#? // array of integers
is there way thats i can preselect an item when the page loads or
Is there some way I can use URLs like: http://www.blog.com/team-spirit/ instead of http://www.blog.com/?p=122 in
Is there a way I can control columns from code. I had a drop
Is there a way I can access (for printout) a list of sub +
Is there a way you can run your UnitTest project against a compiled DLL
Is there some way I can define String[int] to avoid using String.CharAt(int) ?
Is there any way I can detect when my page has been set as
Is there a way I can create Windows firewall exceptions in VB2005? I'm trying
Is there a way I can set up callbacks on (or automataically log) method

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.