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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:02:18+00:00 2026-06-02T21:02:18+00:00

I have an array of the following format: array 0 => array 1335541286 =>

  • 0

I have an array of the following format:

array
  0 => 
    array
      1335541286 => 
        array
          'event' => string 'track' (length=5)
          'title' => string 'Plastic Humans' (length=14)
          'album' => string 'Cities of hunger' (length=16)
          'artist' => string 'The Maple Room' (length=14)
  1 => 
    array
      1335540999 => 
        array
          'event' => string 'track' (length=5)
          'title' => string 'Atlantis' (length=8)
          'album' => string 'Cities of hunger' (length=16)
          'artist' => string 'The Maple Room' (length=14)
  2 => 
    array
      1335540064 => 
        array
          'event' => string 'track' (length=5)
          'title' => string 'Doradus Stars' (length=13)
          'album' => string 'A Glimpse of the Inside' (length=23)
          'artist' => string 'The Maple Room' (length=14)
  3 => 
    array
      1335539855 => 
        array
          'event' => string 'track' (length=5)
          'title' => string 'In Twenty Five' (length=14)
          'album' => string 'A Glimpse of the Inside' (length=23)
          'artist' => string 'The Maple Room' (length=14)
  4 => 
    array
      1334016000 => 
        array
          'event' => string 'purchase' (length=8)
          'title' => string 'Donald Trump - Single' (length=21)
          'artist' => string 'Mac Miller' (length=10)
          'format' => string '10"' (length=3)

I would love to sort the array based on the key, which is the timestamp. I’ve read a lot about PHP sorting methods but i can’t figure out what the best solution would be.

Any help is appreciated,

  • 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-02T21:02:19+00:00Added an answer on June 2, 2026 at 9:02 pm

    using minified data:

    $data = array(
      array('1335541286' => array('1')),
      array('1335540999' => array('1')),
      array('1335540064' => array('1')),
    );
    
    usort($data, function ($a, $b) {
      return key($a) - key($b);
    });
    
    print_r($data);
    

    Also the structure of your input data seems a bit strange. The extra level is not really needed and complicates stuff unnecessarily.

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

Sidebar

Related Questions

I have a array of string in following format. string[] sports = { Cricket
I have an array in the following format: var markers = [ ['Title', 15.102253,
I have an array that contains string with the following format: 1-a1,1-a2,1-a3,1-a4,2-b1,2-b2,2-b3,2-b4,3-c1,3-c2,3-c3,4-d1,4-d2 where a
I have the following string fromat: session=11;reserID=1000001 How to get string array of number?
All, I have the following array in array format. The JSON format is shown
I have string in the following format. Option1:Option2:Option3:Option4 I want to get these items
I have a PHP array of associative arrays with the following format: array(1) {
I have 10 arrays with the following format: This is $data Array ( [0]
I have an array in the following format: Array ( [0] => Array (
I have a multi-dimensional array in the following format: [0] = ( 'id' =>

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.