function bc ($num) { $chars = 'abcdefghijklmnopqrstuvwxyz'; $b = 26; $i = 0; while (true) { if (pow($b, ++$i) > $num) { $i--; break; } } for ($j = $i; $j >= 0; $j--) { $c = $num % pow($b, $j); $c2 = ($num - $c) / pow($b, $j); $s .= substr($chars, $c2, 1); $num = $num - $c2 * pow($b, $j); } return $s; }