Skip to content

Instantly share code, notes, and snippets.

@miyukki
Created July 9, 2011 03:31
Show Gist options
  • Save miyukki/1073268 to your computer and use it in GitHub Desktop.
Save miyukki/1073268 to your computer and use it in GitHub Desktop.
number2alphabet in php
function number2alphabet($instr) {
$alphabettbl = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
$outstr = '';
$len = strlen($instr);
for ($i = 0; $i < $len; $i++) {
$char = substr($instr, $i, 1);
if(is_numeric($char)){
$outstr .= $alphabettbl[$char];
}else{
$outstr .= $char;
}
}
return $outstr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment