Created
October 25, 2010 17:43
-
-
Save filaruina/645373 to your computer and use it in GitHub Desktop.
Sorting array?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$teste = array( | |
array("foo" => "a", "bar" => "b", "timestamp" => 123456), | |
array("foo" => "a", "bar" => "b", "timestamp" => 987654), | |
array("foo" => "a", "bar" => "b", "timestamp" => 654789), | |
array("foo" => "a", "bar" => "b", "timestamp" => 456123) | |
); | |
/* | |
* how to transform that, in this (I mean, ordered by date) | |
*/ | |
$teste = array( | |
array("foo" => "a", "bar" => "b", "timestamp" => 123456), | |
array("foo" => "a", "bar" => "b", "timestamp" => 456123), | |
array("foo" => "a", "bar" => "b", "timestamp" => 654789), | |
array("foo" => "a", "bar" => "b", "timestamp" => 987654) | |
); | |
//I don't want to do a sort by hand, but i can't find a function to do this |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So, the solution by @alganet http://codepad.org/JibW94cM