- /**
- * Binary conversion: decimal, 36 binary conversion
- * by bbs.it-home.org
- */
- $dic = Array (
- 0 = ' 0 ', 1 = ' 1 ', 2 = ' 2 ', 3 = ' 3 ', 4 = ' 4 ', 5 = ' 5 ', 6 = ' 6 ', 7 = ' 7 ', 8 = ' 8 ', 9 =&G T ' 9 ',
- Ten = ' A ', one by one = ' B ', and ' C ', and ' D ', ' E ', ' F ', ' G ', + ' H ', + ' I ',
- + ' J ', + ' K ', + = ' L ', + ' M ', max. ' N ', + ' O ', + ' P ', + = ' Q ' R ',
- (+ = ' S ', + = ' T ', + = ' U ', + = ' V ', + = ' W ', + = ' X ', + = ' Y ', + = ' Z ')
- );
- Decimal Conversion 36 Binary
- Function Enid ($int, $format = 8) {
- Global $dic;
- $arr = Array ();
- $loop = true;
- while ($loop)
- {
- $arr [] = $dic [Bcmod ($int, 36)];
- $int = Floor (Bcdiv ($int, 36));
- if ($int = = 0) {
- $loop = false;
- }
- }
- Array_pad ($arr, $format, $dic [0]);
- Return implode (", Array_reverse ($arr));
- }
- 36 Binary Conversion Decimal
- function Deid ($id) {
- Global $dic;
- Key value Exchange
- $dedic = Array_flip ($dic);
- Go to 0
- $id = LTrim ($id, $dic [0]);
- Reverse
- $id = Strrev ($id);
- $v = 0;
- for ($i = 0, $j = strlen ($id); $i < $j; $i + +)
- {
- $v = Bcadd (Bcmul ($dedic [$id {$i}], Bcpow ($i)), $v);
- }
- return $v;
- }
- Traverse all three-bit 36 binary numbers
- $i = Deid (' ZZZ ');
- $b = Array ();
- while ($i > 0) {
- $id _dym = Str_pad (Enid ($i), 3, 0, str_pad_left);
- Echo strtolower ($id _dym), '
';
- $i--;
- }
Copy Code |