Before php/php-src@834daa455b, PHP's gmp_init() function would try
to autodetect hex and binary numbers even when a base was explicitly
specified[1], so the results for some base-36 numbers having leading
zeros could be incorrect. Work around this bug by trimming off any
leading zeros before calling gmp_init().
[1]: https://bugs.php.net/bug.php?id=50175
Bug: 69249
Change-Id: I5f5458c1a1195f55fa12904c103da6ea7558010a
Also split 2 tests off into their correct test classes,
this methods are clearly no longer global functions
Change-Id: I482433f3099e72507a766e85d9576ff36e58b9ad
Code convensions:
Class names should be UpperCamelCase.
And for PHPUnit:
Class name should end in 'Test'.
Class name should match file name.
Also made headers and spacing a bit more consistent.
Change-Id: Id7b6cec7e552240de44386b4759b57c2d37a39d1
* Added code to use BCMath or GMP if they are
loaded, since they are both significantly faster.
A parameter was added that can be used to force
usage of a specific engine (mainly for testing).
* Made an array of base digits rather than using
strpos() every time.
* Used casting instead of intval(), since the latter
is six times slower.
Also added unit tests for wfBaseConvert as well as
a benchmarking class that measures the difference
between using GMP, BCMath, and pure PHP.
Change-Id: I841717be2b29a0b7fc57a13fde5cc0642cda82df