artbit/base_convert 问题修复 & 功能扩展

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

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

artbit/base_convert

Composer 安装命令:

composer require artbit/base_convert

包简介

Base conversion utility that supports number bases from 2 to 64 (PHP's builtin base_convert supports number bases from 2 through 36)

README 文档

README

Build Status GitHub license GitHub stars awesomeness

PHP's built in base_convert function supports bases ranging from 2 to 36. This library expands that range to 2 to 64.

Usage

Convert a number 100 from decimal to hexadecimal (from base 10 to base 16):

echo math\base_convert(100, 10, 16); 
// echoes '64'

...and back:

echo math\base_convert(64, 16, 10); 
// echoes '100'

Custom alphabets

Instead of integer bases, you can pass in the alphabet string to use for conversion (since integer bases are converted to alphabet strings anyways, i.e. hexadecimal alphabet is simply "0123456789abcdef").

Here we convert from base 10 to alphabet 'customizable'

echo math\base_convert(1234567890, 10, 'customizable');
// echoes 'slmmmmcui'

Here we convert from alphabet 'customizable' to alphabet 'isogram'

echo math\base_convert('slmmmmcui', 'customizable', 'isogram');
// echoes 'rorsirrioig'

And from alphabet 'isogram' back to base 10

echo math\base_convert('rorsirrioig', 'isogram', 10);
// echoes '1234567890'

So both slmmmmcui and rorsirrioig, but also 1234567890 describe the same value, but in different alphabets.

NOTE: All alphabets must be isograms An isogram (also known as a "nonpattern word") is a logological term for a word or phrase without a repeating letter. Conveniently, the word isogram is an isogram as well.

License

MIT

统计信息

  • 总下载量: 10.88k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-05-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固