Convert Largest no: of Base 36 (zzz..zzzz) to Binary
Posted: Sun Aug 08, 2004 1:48 am
Im having a huge list of variables which can either have the value 0 or 1 (for yes or no). I can use arrays too but imagine the list is like some 1000. So I thought instead of having an array of 1000 elements I can have just 1 variable which is a base n representation of the binary form (100111010..001101001..upto 1000 places) and then I can use base_convert to converty it back to binary and do my needful search etc.
string base_convert ( string number, int frombase, int tobase) can take base values from 2 to 36. 36 is the highest (z) So I wanted to know the largest possible binary value for this (Yes this can be done mathematically too) and tried :
This just displays 64 0's. I tried 35z's and 1 y and just 35 z's too but same output.
On the other hand if I convert it dec or hex it shows up.
Is it the memory limitation of 64 bytes ? I was hoping string would handle more.
Any ideas ?
string base_convert ( string number, int frombase, int tobase) can take base values from 2 to 36. 36 is the highest (z) So I wanted to know the largest possible binary value for this (Yes this can be done mathematically too) and tried :
Code: Select all
<?php
$data="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"; // 36 z's - largest number
$dest=base_convert($data,36,2); // Binary representation
echo $dest;
?>On the other hand if I convert it dec or hex it shows up.
Is it the memory limitation of 64 bytes ? I was hoping string would handle more.
Any ideas ?