Swoole\Tool::array_fullness PHP Method

array_fullness() static public method

数组饱满度
static public array_fullness ( $array ) : unknown_type
$array
return unknown_type
    static function array_fullness($array)
    {
        $nulls = 0;
        foreach ($array as $v) {
            if (empty($v) or intval($v) < 0) {
                $nulls++;
            }
        }
        return 100 - intval($nulls / count($array) * 100);
    }