public static function luhn($input) {
        if ($input == 0) {
            return false;
        }

        $sum = 0;
        $length = mb_strlen($input);

        for ($position = 1 - ($length % 2); $position < $length; $position += 2) {
            $sum += $input[$position];
        }

        for ($position = ($length % 2); $position < $length; $position += 2) {
            $number = $input[$position] * 2;
            $sum += ($number < 10) ? $number : $number - 9;
        }

        return ($sum % 10 == 0);
    }