strcmp equivelant for integers (intcmp) in PHP

Sort your data with:

function sortScripts($a, $b)
{
    return $a['order'] - $b['order'];
}

Use $b-$a if you want the reversed order.

If the numbers in question exceed PHP’s integer range, return ($a < $b) ? -1 : (($a > $b) ? 1 : 0) is more robust.

Leave a Comment