i'm thinking you can use an array to give a certain number a letter.
$letter = array('a','b','c','d',.......);
so $letter[1] will be letter 'b'.
just modify above for your needs.
you can get a string's length with strlen() function.
hmm. maybe this function str_rot13() might help.
good luck.