2017 © Pedro Peláez
 

library base-convert

Convert an arbitrarily-long string from one numeric base to another, optionally zero-padding to a minimum column width.

image

wikimedia/base-convert

Convert an arbitrarily-long string from one numeric base to another, optionally zero-padding to a minimum column width.

  • Saturday, July 28, 2018
  • by mediawiki
  • Repository
  • 18 Watchers
  • 2 Stars
  • 158,734 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 3 Versions
  • 7 % Grown

The README.md

![Latest Stable Version] ![License], (*1)

Improved base_convert for PHP

PHP's base_convert function does not handle large numbers well. This library does, and can also optionally zero-pad to a minimum column width., (*2)

It is a drop-in replacement for base_convert, supporting base 2 through 36, and has additional features for padding and case., (*3)

The gmp and bcmath extensions are optionally used for improved performance., (*4)

Additional documentation about the library can be found on MediaWiki.org., (*5)

Usage

// Using padding, outputs 01010
\Wikimedia\base_convert( 'a', '36', '2', '5' )

Running tests

composer install --prefer-dist
composer test

History

This library was first introduced in MediaWiki 1.7 (r14777), and overhauled in MediaWiki 1.21 (9b9daadc46). It was split out of the MediaWiki codebase and published as an independent library during the MediaWiki 1.27 development cycle., (*6)


The Versions

28/07 2018

dev-master

9999999-dev https://www.mediawiki.org/wiki/base_convert

Convert an arbitrarily-long string from one numeric base to another, optionally zero-padding to a minimum column width.

  Sources   Download

GPL-2.0+ GPL-2.0-or-later

The Requires

  • php >=5.5.9

 

The Development Requires

by Brion Vibber

29/10 2015

v1.0.1

1.0.1.0 https://www.mediawiki.org/wiki/base_convert

Convert an arbitrarily-long string from one numeric base to another, optionally zero-padding to a minimum column width.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.3

 

The Development Requires

by Brion Vibber

29/10 2015

v1.0.0

1.0.0.0 https://www.mediawiki.org/wiki/base_convert

Convert an arbitrarily-long string from one numeric base to another, optionally zero-padding to a minimum column width.

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.3

 

The Development Requires

by Brion Vibber