定制 delhombre/binary-converter 二次开发

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

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

delhombre/binary-converter

最新稳定版本:v1.0.2

Composer 安装命令:

composer require delhombre/binary-converter

包简介

A simple and efficient package to convert numbers to their binary equivalent using PHP

README 文档

README

BinaryConverter PHP

GitHub Workflow Status (main) Total Downloads Latest Version License

BinaryConverter is a PHP library that converts binary numbers to decimal numbers and vice versa. It also supports hexadecimal conversion.

Get Started

Requires PHP 8.1+

First, install BinaryConverter via the Composer package manager:

composer require delhombre/binary-converter

Then, interact with the package:

$converter = BinaryConverter::from(2024);

$bin = $converter->toBinary();

dd($bin); // "11111101000"

You can pass the input as a string or as an integer.

dd(BinaryConverter::from('2024')->toBinary()); // "11111101000"

But sometimes you may want to convert a binary number to a decimal number. You can do it by passing the inputType parameter like this:

dd(BinaryConverter::from('11111101000', 'binary')->toDecimal()); // 2024

BinaryConverter PHP is an open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-07