private static function _crockfordDecodeToIntStr($encodedStr, $encodedStrLen, $mapping) {
        // Try to use PHP's internal integer type.
        if (($encodedStrLen * 5 / 8) <= PHP_INT_SIZE) {
            $int = 0;
            for ($i = 0; $i < $encodedStrLen; $i++) {
                $int <<= 5;
                $int |= $mapping[$encodedStr[$i]];
            }
            if ($int >= 0)
                return $int;
        }

        // If we did not already return here, PHP's internal integer type can not
        // hold the encoded value. Now we use PHP's BC Math library instead and
        // return the integer as string.
        if (extension_loaded('bcmath')) {
            $intStr = '0';
            for ($i = 0; $i < $encodedStrLen; $i++) {
                $intStr = bcmul($intStr, '32', 0);
                $intStr = bcadd($intStr, (string) $mapping[$encodedStr[$i]], 0);
            }
            return $intStr;
        } else {
            throw new RuntimeException('BC Math functions are not available.', self::E_NO_BCMATH);
        }
    }
private static function _crockfordDecodeToIntStr($encodedStr, $encodedStrLen, $mapping) {
        // Try to use PHP's internal integer type.
        if (($encodedStrLen * 5 / 8) <= PHP_INT_SIZE) {
            $int = 0;
            for ($i = 0; $i < $encodedStrLen; $i++) {
                $int <<= 5;
                $int |= $mapping[$encodedStr[$i]];
            }
            if ($int >= 0)
                return $int;
        }

        // If we did not already return here, PHP's internal integer type can not
        // hold the encoded value. Now we use PHP's BC Math library instead and
        // return the integer as string.
        if (extension_loaded('bcmath')) {
            $intStr = '0';
            for ($i = 0; $i < $encodedStrLen; $i++) {
                $intStr = bcmul($intStr, '32', 0);
                $intStr = bcadd($intStr, (string) $mapping[$encodedStr[$i]], 0);
            }
            return $intStr;
        } else {
            throw new RuntimeException('BC Math functions are not available.', self::E_NO_BCMATH);
        }
    }
private static function _crockfordDecodeToIntStr ( $ encodedStr , $ encodedStrLen , $ mapping ) { // Try to use PHP's internal integer type. if ( ( $ encodedStrLen * 5 / 8 ) <= PHP_INT_SIZE ) { $ int = 0 ; for ( $ i = 0 ; $ i < $ encodedStrLen ; $ i ++ ) { $ int <<= 5 ; $ int |= $ mapping [ $ encodedStr [ $ i ] ] ; } if ( $ int >= 0 ) return $ int ; } // If we did not already return here, PHP's internal integer type can not // hold the encoded value. Now we use PHP's BC Math library instead and // return the integer as string. if ( extension_loaded ( 'bcmath' ) ) { $ intStr = '0' ; for ( $ i = 0 ; $ i < $ encodedStrLen ; $ i ++ ) { $ intStr = bcmul ( $ intStr , '32' , 0 ) ; $ intStr = bcadd ( $ intStr , ( string ) $ mapping [ $ encodedStr [ $ i ] ] , 0 ) ; } return $ intStr ; } else { throw new RuntimeException ( 'BC Math functions are not available.' , self :: E_NO_BCMATH ) ; } }
Decodes the given base32 encoded string using the given character
mapping to an integer.

Expects the given encoded string to be padding free!

Uses PHP's BC Math library if the integer represented by the given bytes
is too big to be stored in PHP's internal integer type. In this case a
string containing the integer is returned, otherwise a native integer.

@param string $encodedStr The encoded string.
@param int $encodedStrLen Length of the encoded string.
@param array $mapping Associative array mapping the characters in the
encoded string to the values they represent.
@return mixed A non-negative integer or a string representing a
non-negative integer.
@throws RuntimeException
Decodes the given base32 encoded string using the given character mapping to an integer .