Jump to content

[SOLVED] usort() help


ballhogjoni

Recommended Posts

I want to sort a multi array but don't know how to do it. I read the manual, but it seems pretty complex. In the example below, I want to sort the array by the name. So the array should look like the second example I have.

 

Array
(
    [0] => Array
        (
            [id] => 1386
            [name] => c
            [date_started] => 2006-07-24 12:51:16
        )

    [1] => Array
        (
            [id] => 1849
            [name] => d
            [date_started] => 2007-01-04 10:02:21
        )

    [2] => Array
        (
            [id] => 4857
            [name] => a
            [date_started] => 2008-08-22 14:42:35
        )
)

 

Array
(
    [0] => Array
        (
            [id] => 4857
            [name] => a
            [date_started] => 2008-08-22 14:42:35
        )

    [1] => Array
        (
            [id] => 1386
            [name] => c
            [date_started] => 2006-07-24 12:51:16
        )

    [2] => Array
        (
            [id] => 1849
            [name] => d
            [date_started] => 2007-01-04 10:02:21
        )
)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.