Skip to content

Instantly share code, notes, and snippets.

@pierrre
Created April 9, 2013 11:59
Show Gist options
  • Save pierrre/5345134 to your computer and use it in GitHub Desktop.
Save pierrre/5345134 to your computer and use it in GitHub Desktop.
Ne jamais coder bourré
usort($objects, function($a, $b){
$a1 = $a->getName();
$b1 = $b->getName();
if ($a1 == $b1) {
return strnatcmp($a1, $b1);
} else {
return strnatcmp($a->getName(), $b->getName());
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment