public static function mode(array $values) : float
    {
        if (empty($values)) {
            throw new InvalidArgumentException('Mode is undefined for empty'
                . ' set.');
        }

        $counts = array_count_values(array_map('strval', $values));

        return (float) argmax($counts);
    }
public static function mode(array $values) : float
    {
        if (empty($values)) {
            throw new InvalidArgumentException('Mode is undefined for empty'
                . ' set.');
        }

        $counts = array_count_values(array_map('strval', $values));

        return (float) argmax($counts);
    }
public static function mode ( array $ values ) : float { if ( empty ( $ values ) ) { throw new InvalidArgumentException ( 'Mode is undefined for empty' . ' set.' ) ; } $ counts = array_count_values ( array_map ( 'strval' , $ values ) ) ; return ( float ) argmax ( $ counts ) ; }
Find a mode of a set of values i.e a value that appears most often in the
set.

@param array $values
@throws \InvalidArgumentException
@return float
Find a mode of a set of values i . e a value that appears most often in the set .