PHP Sort a multidimensional array by element containing date

Posted by user270797 on Stack Overflow See other posts from Stack Overflow or by user270797
Published on 2010-05-26T06:39:40Z Indexed on 2010/05/26 6:51 UTC
Read the original article Hit count: 324

Filed under:
|
|
|

I have an array such as:

Array
(
[0] => Array
    (
        [id] => 2
        [type] => comment
        [text] => hey
        [datetime] => 2010-05-15 11:29:45
    )

[1] => Array
    (
        [id] => 3
        [type] => status
        [text] => oi
        [datetime] => 2010-05-26 15:59:53
    )

[2] => Array
    (
        [id] => 4
        [type] => status
        [text] => yeww
        [datetime] => 2010-05-26 16:04:24
    )

)

Can anyone suggest a way to sort/order this based on the datetime element?

© Stack Overflow or respective owner

Related posts about php

Related posts about datetime