ok, if you are here, its because you want to know how you can change numbers into letters.

for example, wouldn't it be cool if i had this number:

389 and convert it to something like this: xyz

i often use the base64_encode() function when i want to change numbers into letters

ok here we go. the first thing we are going to do is create an array to declare our number zero through nine, so i will use this code:

$numbers = array();
for($counter =0; $counter <= 10; $counter++) {
$numbers[$counter] = $counter;
}


now the second part will be to create a function so the function can search our string and change any numbers it finds within our string and change them into letters. so i would use this functions:

function change_to_letters($string) {
global $numbers;
$replacements = array("a","b","c","d","e","f","g","h","i","j");
$string = str_replace($numbers, $replacements, $string);
return $string;
}


ok, now that we have these, we can put our script all together, so lets do it and see how it works in actions.. the first you i want you to do is open your text editor. im using windows xp, so ill be using notepad for this turorials. so open a blank notepad and copy and paste this code into notepad:
numbers-into-letters.php:
<h1><a href="http://www.wallpaperama.com">WALLPAPERAMA.COM</a></h1>
<?
# THIS FILE WAS CREATED BY WALLPAPERAMA.COM - PLEASE DO NOT REMOVE THIS - THANK YOU

# MAKE STRING INTO ARRAY TO FOR NUMBERS 0-9
$numbers = array();
for($counter =0; $counter <= 10; $counter++) {
$numbers[$counter] = $counter;
}
# FUCNTION TO CHANGE NUMBER INTO LETTERS
function change_to_letters($string) {
global $numbers;
$replacements = array("a","b","c","d","e","f","g","h","i","j");
$string = str_replace($numbers, $replacements, $string);
return $string;
}
if(isset($_POST['submit'])){
echo 'I changed '.$_POST['string'].' to this:<div style="border: 1px solid #666;background-color: #E6FAD9;width:200px;padding:5px;">'.change_to_letters($_POST['string']).'</div>';
}

?>
<p>Hello, Thanks for checking out this script create by Wallpaperama.com to show you how you can convert numbers into letters.</p>
<form action="" method="post">
Enter some numbers here and i will change them into letters:<br /><input name="string" type="text" size="15" maxlength="10"><br />
<input type="submit" name="submit" value="Convert"><br />
</form>
<p align="center">Check out more scripts like this at <a href="http://www.wallpaperama.com">www.wallpaperama.com</a></p>
<p align="center">&lt;&lt; Go back to <a href="http://www.wallpaperama.com/forums/convert-or-change-numbers-into-letter-ascii-in-php-t306.html">Convert Or Change Numbers Into Letter</a></p>



2. now that you have copied and paste this code into notepad, save it as numbers-into-letters.php

3. upload numbers-into-letters.php to your PHP website and open it with your browser to see the script in action.

4. now if you dont have the patients to do it yourself, i put it all together so you can see it in action. Change Numbers Into Letters Tutorial

i would recommend that you tested on your site to make sure it works for you.

if you learned anything, i would appreciate your comments please.

thanks.