PMA\libraries\DatabaseInterface::_usortComparisonCallback PHP Method

_usortComparisonCallback() private static method

usort comparison callback
private static _usortComparisonCallback ( string $a, string $b ) : integer
$a string first argument to sort
$b string second argument to sort
return integer a value representing whether $a should be before $b in the sorted array or not
    private static function _usortComparisonCallback($a, $b)
    {
        if ($GLOBALS['cfg']['NaturalOrder']) {
            $sorter = 'strnatcasecmp';
        } else {
            $sorter = 'strcasecmp';
        }
        /* No sorting when key is not present */
        if (!isset($a[$GLOBALS['callback_sort_by']]) || !isset($b[$GLOBALS['callback_sort_by']])) {
            return 0;
        }
        // produces f.e.:
        // return -1 * strnatcasecmp($a["SCHEMA_TABLES"], $b["SCHEMA_TABLES"])
        return ($GLOBALS['callback_sort_order'] == 'ASC' ? 1 : -1) * $sorter($a[$GLOBALS['callback_sort_by']], $b[$GLOBALS['callback_sort_by']]);
    }