Piwik\DataTable\Row::compareElements PHP Method

compareElements() public static method

Helper function to compare array elements
public static compareElements ( mixed $elem1, mixed $elem2 ) : boolean
$elem1 mixed
$elem2 mixed
return boolean
    public static function compareElements($elem1, $elem2)
    {
        if (is_array($elem1)) {
            if (is_array($elem2)) {
                return strcmp(serialize($elem1), serialize($elem2));
            }
            return 1;
        }
        if (is_array($elem2)) {
            return -1;
        }
        if ((string) $elem1 === (string) $elem2) {
            return 0;
        }
        return (string) $elem1 > (string) $elem2 ? 1 : -1;
    }