I know this is a pretty silly question, but I don't know what to do.

I have an arbitrary binary number, say,

```
1001000000110010000000100100000010000011000000010001000001011000110000110000011100011100000011000000010010011000100000000000000100100000010110001100001000000111

```

I want to convert it to Base 64 using PHP - and every way I try gives me a different result. Even different online converters convert it differently:

<http://home2.paulschou.net/tools/xlate/>  

<http://convertxy.com/index.php/numberbases/>

PHP's base\_convert only works up to base36, and base64\_encode expects a string.

What do I do?

**UPDATE**: I implemented the solution functions suggested by **@binaryLV**, and it did work well.

However, I compared the results to PHP's built-in **base\_convert**. It turned out that base\_convert to base36 returns shorter values that the custom base64 function! (And yes, I did prepend a '1' to all the binary numbers to ensure leading zeros aren't lost).

I have noticed, too, that **base\_convert** is quite innacurate with large numbers. So I need is a function which works like base\_convert, but accurately and, preferably, up to base 64.