Correclty use usort.

This commit is contained in:
Andrew Tomaka 2011-12-04 04:05:33 -05:00
parent 0558ad0609
commit cf2df2920f

View file

@ -115,7 +115,7 @@ function github() {
// & notation for a variable to be passed by reference is actually // & notation for a variable to be passed by reference is actually
// deprecated and will cause a warning in 5.3. However, it is // deprecated and will cause a warning in 5.3. However, it is
// required to work in 5.2 // required to work in 5.2
usort(&$repos,'github_sort'); usort($repos,'github_sort');
// and then get the last commit to that repo // and then get the last commit to that repo
$url = sprintf('https://api.github.com/repos/atomaka/%s/commits', $url = sprintf('https://api.github.com/repos/atomaka/%s/commits',
@ -311,7 +311,7 @@ function wow() {
// & notation for a variable to be passed by reference is actually // & notation for a variable to be passed by reference is actually
// deprecated and will cause a warning in 5.3. However, it is // deprecated and will cause a warning in 5.3. However, it is
// required to work in 5.2 // required to work in 5.2
usort(&$characterData,'ilvl_sort'); usort($characterData,'ilvl_sort');
$data = $characterData; $data = $characterData;
@ -364,7 +364,7 @@ function urlify($string) {
return preg_replace($pattern,"<a href=\"$1\">$1</a>", $string); return preg_replace($pattern,"<a href=\"$1\">$1</a>", $string);
} }
function github_sort($a, $b) { function github_sort(&$a, &$b) {
return strtotime($a->pushed_at) < strtotime($b->pushed_at); return strtotime($a->pushed_at) < strtotime($b->pushed_at);
} }