PHPackages                             carrontiger/conversion - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. carrontiger/conversion

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

carrontiger/conversion
======================

Conversion from/to decimal numerals.

v1.0.2(2y ago)05Apache-2.0PHPPHP ^7.4|^8.0|^8.1|^8.2

Since Apr 7Pushed 2y ago1 watchersCompare

[ Source](https://github.com/carrontiger/conversion)[ Packagist](https://packagist.org/packages/carrontiger/conversion)[ RSS](/packages/carrontiger-conversion/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (4)Used By (0)

Conversion
==========

[](#conversion)

Conversion from/to decimal numerals

Comparison of Converters
------------------------

[](#comparison-of-converters)

### Examples

[](#examples)

ConverterResult of `toDecimal()`Result of `fromDecimal()``BinaryConverter`21474836471111111111111111111111111111111`OctalConverter`214748364717777777777`HexadecimalConverter`21474836477FFFFFFF`CaseInsensitiveAlphaDecimalConverter`2147483647ZIK0ZJ`CaseSensitiveAlphaDecimalConverter`21474836472LKcb1`AsciiDecimalConverter`2147483647Rll}&amp;### Meta Information

[](#meta-information)

ConverterBase“Digits”`BinaryConverter`2`01``OctalConverter`8`01234567``HexadecimalConverter`16`0123456789ABCDEF``CaseInsensitiveAlphaDecimalConverter`36`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ``CaseSensitiveAlphaDecimalConverter`62`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz``AsciiDecimalConverter`94`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!"#$%&'()*+,-./:;?@[\]^_`{|}~`Individual Examples
-------------------

[](#individual-examples)

### Binary Numerals

[](#binary-numerals)

##### Conversion of decimal numeral to a binary numeral

[](#conversion-of-decimal-numeral-to-a-binary-numeral)

```
use carrontiger\Conversion\BinaryConverter;

$binaryConverter = new BinaryConverter();

echo $binaryConverter->fromDecimal(123);
//  "01111011"
```

##### Conversion of binary numeral to a decimal numeral

[](#conversion-of-binary-numeral-to-a-decimal-numeral)

```
use carrontiger\Conversion\BinaryConverter;

$binaryConverter = new BinaryConverter();

echo $binaryConverter->toDecimal('01111011');
//  123
```

### Octal Numerals

[](#octal-numerals)

##### Conversion of decimal numeral to a octal numeral

[](#conversion-of-decimal-numeral-to-a-octal-numeral)

```
use carrontiger\Conversion\OctalConverter;

$octalConverter = new OctalConverter();

echo $octalConverter->fromDecimal(123);
//  "173"
```

##### Conversion of octal numeral to a decimal numeral

[](#conversion-of-octal-numeral-to-a-decimal-numeral)

```
use carrontiger\Conversion\BinaryConverter;

$octalConverter = new OctalConverter();

echo $octalConverter->toDecimal('173');
//  123
```

### Hexadecimal Numerals

[](#hexadecimal-numerals)

##### Conversion of decimal numeral to a hexadecimal numeral

[](#conversion-of-decimal-numeral-to-a-hexadecimal-numeral)

```
use carrontiger\Conversion\HexadecimalConverter;

$hexadecimalConverter = new HexadecimalConverter()

echo $hexadecimalConverter->fromDecimal(123);
//  "7B"
```

##### Conversion of hexadecimal numeral to a decimal numeral

[](#conversion-of-hexadecimal-numeral-to-a-decimal-numeral)

```
use carrontiger\Conversion\HexadecimalConverter;

$hexadecimalConverter = new HexadecimalConverter();

echo $hexadecimalConverter->toDecimal('7B');
//  123
```

### Case-Insensitive Alpha-Decimal Numerals

[](#case-insensitive-alpha-decimal-numerals)

The *case-insensitive alpha-decimal numeral* encoding uses the following 36 “digits”:

`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ`

##### Conversion of decimal numeral to a case-insensitive alpha-decimal numeral

[](#conversion-of-decimal-numeral-to-a-case-insensitive-alpha-decimal-numeral)

```
use carrontiger\Conversion\CaseInsensitiveAlphaDecimalConverter;

$ciAlphaDecimalConverter = new CaseInsensitiveAlphaDecimalConverter()

echo $ciAlphaDecimalConverter->fromDecimal(123);
//  "3F"
```

##### Conversion of a case-insensitive alpha-decimal numeral to a decimal numeral

[](#conversion-of-a-case-insensitive-alpha-decimal-numeral-to-a-decimal-numeral)

```
use carrontiger\Conversion\CaseInsensitiveAlphaDecimalConverter;

$ciAlphaDecimalConverter = new CaseInsensitiveAlphaDecimalConverter();

echo $ciAlphaDecimalConverter->toDecimal('3F');
//  123
```

### Case-Sensitive Alpha-Decimal Numerals

[](#case-sensitive-alpha-decimal-numerals)

The *case-sensitive alpha-decimal numeral* encoding uses the following 62 “digits”:

`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`

##### Conversion of decimal numeral to a case-sensitive alpha-decimal numeral

[](#conversion-of-decimal-numeral-to-a-case-sensitive-alpha-decimal-numeral)

```
use carrontiger\Conversion\CaseSensitiveAlphaDecimalConverter;

$alphaDecimalConverter = new CaseSensitiveAlphaDecimalConverter()

echo $alphaDecimalConverter->fromDecimal(123);
//  "1z"
```

##### Conversion of a case-sensitive alpha-decimal numeral to a decimal numeral

[](#conversion-of-a-case-sensitive-alpha-decimal-numeral-to-a-decimal-numeral)

```
use carrontiger\Conversion\CaseSensitiveAlphaDecimalConverter;

$alphaDecimalConverter = new CaseSensitiveAlphaDecimalConverter();

echo $alphaDecimalConverter->toDecimal('1z');
//  123
```

### ASCII-Numerals

[](#ascii-numerals)

The *ASCII numeral* encoding uses the following 94 “digits”:

`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!"#$%&'()*+,-./:;?@[\]^_`{\|}~`

Due to the use of non-alphabetic characters, it is not practical for *ASCII numerals*to be embedded in texts or be used as plain HTTP query arguments, for example. One purpose would be to encode large integer numbers, compactly. But most of all, this is an example of an arbitrary numeral system, than one can define.

If you were to define a numeral system (by extending the `AbstractDecimalConverter` class), be advised, to use only **one-byte characters** as digits.

##### Conversion of decimal numeral to an ASCII numeral

[](#conversion-of-decimal-numeral-to-an-ascii-numeral)

```
use carrontiger\Conversion\AsciiDecimalConverter;

$asciiDecimalConverter = new AsciiDecimalConverter()

echo $asciiDecimalConverter->fromDecimal(123);
//  "1T"
```

##### Conversion of an ASCII numeral to a decimal numeral

[](#conversion-of-an-ascii-numeral-to-a-decimal-numeral)

```
use carrontiger\Conversion\AsciiDecimalConverter;

$asciiDecimalConverter = new AsciiDecimalConverter()

echo $asciiDecimalConverter->toDecimal('1T');
//  123
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

771d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/258bc1f02b27fa0b0a1c21640063c0a9e625ffb168cc4acec9ff7143300af77d?d=identicon)[carrontiger](/maintainers/carrontiger)

---

Top Contributors

[![carrontiger](https://avatars.githubusercontent.com/u/22706480?v=4)](https://github.com/carrontiger "carrontiger (10 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/carrontiger-conversion/health.svg)

```
[![Health](https://phpackages.com/badges/carrontiger-conversion/health.svg)](https://phpackages.com/packages/carrontiger-conversion)
```

###  Alternatives

[sbodak/magento2-checkout-custom-form

Add a custom form to Magento 2 checkout on the shipping step.

993.5k](/packages/sbodak-magento2-checkout-custom-form)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
