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
https://forums.phpfreaks.com/topic/139879-solved-usort-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.