alexkr/biject

双射类

1.0 2015-07-07 18:23 UTC

This package is not auto-updated.

Last update: 2024-09-18 08:16:31 UTC


README

PHP上的简单一对一映射函数实现。

构建状态:Build Status

代码示例

编码

$bijection = new AlexKR\Biject\Bijection();
$result = $bijection->encode(42); //q

解码

$bijection = new AlexKR\Biject\Bijection();
$result = $bijection->decode('iq'); //512

更改字母表

$bijection = new AlexKR\Biject\Bijection('0123456789');
$result = $bijection->encode(17); //17

安装

通过Composer安装

composer require alexkr/Biject

许可证

Biject在MIT许可证下授权