function emailEncode($i)
{
$alphabet = "abcdefghijklmnopqrstuvwxyz0123456789._-";
$alphabet = str_split($alphabet);
if ($i == 0)
return $alphabet[0];
$result = '';
$base = count($alphabet);
while ($i > 0)
{
$result[] = $alphabet[($i % $base)];
$i = floor($i / $base);
}
$result = array_reverse($result);
return join("", $result);
}