Skip to content

Instantly share code, notes, and snippets.

@filaruina
Created October 25, 2010 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save filaruina/645373 to your computer and use it in GitHub Desktop.
Save filaruina/645373 to your computer and use it in GitHub Desktop.
Sorting array?
$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
@filaruina
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment