Skip to content

Instantly share code, notes, and snippets.

@fran6co
Created May 30, 2014 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fran6co/a8b924f3500aad90a4bc to your computer and use it in GitHub Desktop.
Save fran6co/a8b924f3500aad90a4bc to your computer and use it in GitHub Desktop.
<?php
$gatos = array(
array(
"id" => 1,
"name" => "Titus",
"fecha" => new \DateTime(),
),
array(
"id" => 2,
"name" => "Gato",
"fecha" => new \DateTime(),
),
);
usort($gatos, function($gato1,$gato2){
return strcmp($gato1["fecha"]->format("md"),$gato2["fecha"]->format("md"));
});
var_dump($gatos);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment