定制 mggflow/int-coder 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

mggflow/int-coder

最新稳定版本:v1.1.0

Composer 安装命令:

composer require mggflow/int-coder

包简介

README 文档

README

About

This package can encode some integer in range [a; b] to string code with given length and alphabet. And can decode back.

Usage

To install:

composer require mggflow/int-coder

Example:

$min = 3537;
$max = PHP_INT_MAX;

$alphabet = [
    'a', 'b', 'c', 'd',
    'e', 'f', 'g', 'h',
    'i', 'j', 'k', 'l',
    'm', 'n', 'o', 'p',
    'q', 'r', 's', 't',
    'u', 'v', 'w',
    'x', 'y', 'z',
    '0', '1', '2', '3',
    '4', '5', '6', '7',
    '8', '9'
];
$codeLength = 16;

$number = 931781;

$coder = new Int2Code($min, $max, $alphabet, $codeLength);
$decoder = new Code2Int($min, $max, $alphabet, $codeLength);

$code = $coder->encode($number);
echo "code: " . $code . "\n";
$decNumber = $decoder->decode($code);
echo "decoded number: " . $decNumber . "\n";

Expected output:

code: fkt2fs9qbwlams1u
decoded number: 931781

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-11-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固