PHPackages                             cast/base-convert - 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. cast/base-convert

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

cast/base-convert
=================

Base convert. Based on https://www.php.net/manual/ru/function.base-convert.php#106546

0.4(4y ago)0401[1 PRs](https://github.com/windlace/base-convert/pulls)1MITPHPPHP ^7.2CI failing

Since Apr 22Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/windlace/base-convert)[ Packagist](https://packagist.org/packages/cast/base-convert)[ RSS](/packages/cast-base-convert/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependencies (1)Versions (6)Used By (1)

Base convert
------------

[](#base-convert)

Convert an arbitrarily large number from any base to any base.

#### Install:

[](#install)

```
composer require cast/base-convert
```

`string convBase(string $numberInput, string $fromBaseInput, string $toBaseInput)`
`$numberInput` - number to convert as a string
`$fromBaseInput` - base of the number to convert as a string
`$toBaseInput` - base the number should be converted to as a string

Examples for `$fromBaseInput` and `$toBaseInput`
`0123456789ABCDEF` for Hexadecimal (Base16)
`0123456789` for Decimal (Base10)
`01234567` for Octal (Base8)
`01` for Binary (Base2)

You can really put in whatever you want and the first character is the 0.

#### Examples:

[](#examples)

```
