By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,831 Members | 2,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,831 IT Pros & Developers. It's quick & easy.

converting phone numbers to alphabets

P: n/a
fo
Does anyone know if there is a free code available to convert numbers to
text and/or text to numbers?

Thanks
Jul 17 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
numbers to text is impossble, since per number, you have multiple letters.
letters to numbers would be an easy one to write yourself, wouldn't it?

Mich

"fo" <so*******@downunder.com.au> wrote in message
news:cc**********@otis.netspace.net.au...
Does anyone know if there is a free code available to convert numbers to
text and/or text to numbers?

Thanks

Jul 17 '05 #2

P: n/a
*** fo wrote/escribió (Wed, 7 Jul 2004 16:08:09 +1000):
Does anyone know if there is a free code available to convert numbers to
text and/or text to numbers?


As you as you use a numeric variable in a context that requires strings,
it's automatically converted. E.G:

<?
$foo=33;
echo "Foo=$foo";
?>

As about the opposite, you can use cast operators:

<?
$foo=(int)'33';
?>

Since phone numbers usually have dots, parenthesis and dashes, you should
remove them first. A simple regex will do:

<?
$foo=eregi_replace('[^0-9]+', '', '902-99 99 99'); // Untested!
?>

Also, please note than handling phone numbers as text will remove leading
zeroes.
--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Jul 17 '05 #3

P: n/a
I noticed that Message-ID: <1r******************************@40tude.net>
from Alvaro G Vicario contained the following:
Also, please note than handling phone numbers as text will remove leading
zeroes.


Don't you mean 'handling phone numbers as numbers'.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #4

P: n/a
*** Geoff Berrow wrote/escribió (Wed, 07 Jul 2004 07:38:09 +0100):
Also, please note than handling phone numbers as text will remove leading
zeroes.


Don't you mean 'handling phone numbers as numbers'.


Yes, sorry.

--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Jul 17 '05 #5

P: n/a
fo
What I am looking for to more or less this
http://www.cheapnumbers.com/cgi-bin/spell.cgi
"fo" <so*******@downunder.com.au> wrote in message
news:cc**********@otis.netspace.net.au...
Does anyone know if there is a free code available to convert numbers to
text and/or text to numbers?

Thanks

Jul 17 '05 #6

P: n/a
"fo" <so*******@downunder.com.au> wrote in message
news:cc**********@otis.netspace.net.au...
What I am looking for to more or less this
http://www.cheapnumbers.com/cgi-bin/spell.cgi
"fo" <so*******@downunder.com.au> wrote in message
news:cc**********@otis.netspace.net.au...
Does anyone know if there is a free code available to convert numbers to
text and/or text to numbers?

Thanks


Not that I'm aware of. Shouldn't be too hard to code though. Just take a
word list, convert words with less than 7 letters to phone#, then insert
them into a hash table, something along the line of

array (
3456 => array('baby', 'dog', 'dingo'),
1234567 => array ( 'chicken', 'clinton', 'sweden' ... )
)

Serialize the hash table into a file. To retrieve a list of possible match,
just load the table and do a lookup. The trick I guess is finding
conbination of words. Should still be simply if you limit yourself to two
word conbinations.
Jul 17 '05 #7

P: n/a
I noticed that Message-ID: <cc**********@otis.netspace.net.au> from fo
contained the following:
What I am looking for to more or less this
http://www.cheapnumbers.com/cgi-bin/spell.cgi


Ahhh..

tricky...

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #8

P: n/a
"Chung Leong" <ch***********@hotmail.com> wrote

[...]
The trick I guess is finding conbination of words.


I think that's actually what the OP would like the script to do. Quite
tricky, maybe somehow like this:

// make array of digit's character values
$digits = array(array ("&amp", "@"), array("a", "b", "c"), array("d", "e",
"f"), ... );

// make array of number
$number = chunk_split((strval($number), 1, ':');
$array = explode(":",$number);
array_pop($array);

// Then make complex loops to make every possible combination of characters
and compare them with word list; I don't have the time to figure this out -
as the number length and thus the depth of loops vary it might be necessary
to use a function called for every digit of it.

--
Markus
Jul 17 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.