krak/luhn 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

krak/luhn

Composer 安装命令:

composer require krak/luhn

包简介

Luhn Algorithm Library

README 文档

README

Luhn mod10 algorithms

Install

composer require krak/luhn

Usage

<?php

use function Krak\Luhn\luhn_validate,
    Krak\Luhn\luhn_checksum;

$ccnumber = '79927398713';

var_dump(luhn_validate($ccnumber));
// bool(true)

var_dump(luhn_checksum(substr($ccnumber, 0, -1)));
// int(67)

API

bool luhn_validate($number_string);
int luhn_checksum($number_string);

luhn_validate takes a numeric string and performs a mod10 check on it and verifies if it matches or not.

luhn_checksum takes a numeric string and returns the luhn checksum of it. This is used internally by the luhn_validate to compare a string with its last digit.

Test

You can run tests with peridot using make

make test

统计信息

  • 总下载量: 59
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-04-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固