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" <somewhere@down under.com.au> wrote in message
news:ccg40e$iav $1@otis.netspac e.net.au...[color=blue]
> Does anyone know if there is a free code available to convert numbers to
> text and/or text to numbers?
>
> Thanks
>
>[/color]
*** fo wrote/escribió (Wed, 7 Jul 2004 16:08:09 +1000):[color=blue]
> Does anyone know if there is a free code available to convert numbers to
> text and/or text to numbers?[/color]
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:
I noticed that Message-ID: <1ruuwzj34sjsy. 16eh22yempkml$. dlg@40tude.net>
from Alvaro G Vicario contained the following:
[color=blue]
>Also, please note than handling phone numbers as text will remove leading
>zeroes.[/color]
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/
*** Geoff Berrow wrote/escribió (Wed, 07 Jul 2004 07:38:09 +0100):[color=blue][color=green]
>>Also, please note than handling phone numbers as text will remove leading
>>zeroes.[/color]
>
> Don't you mean 'handling phone numbers as numbers'.[/color]
"fo" <somewhere@down under.com.au> wrote in message
news:ccg40e$iav $1@otis.netspac e.net.au...[color=blue]
> Does anyone know if there is a free code available to convert numbers to
> text and/or text to numbers?
>
> Thanks
>
>[/color]
"fo" <somewhere@down under.com.au> wrote in message
news:ccg9qp$nc0 $1@otis.netspac e.net.au...[color=blue]
> What I am looking for to more or less this
> http://www.cheapnumbers.com/cgi-bin/spell.cgi
> "fo" <somewhere@down under.com.au> wrote in message
> news:ccg40e$iav $1@otis.netspac e.net.au...[color=green]
> > Does anyone know if there is a free code available to convert numbers to
> > text and/or text to numbers?
> >
> > Thanks[/color][/color]
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
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.
I noticed that Message-ID: <ccg9qp$nc0$1@o tis.netspace.ne t.au> from fo
contained the following:
[color=blue]
>What I am looking for to more or less this
>http://www.cheapnumbers.com/cgi-bin/spell.cgi[/color]
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/
[...]
[color=blue]
> The trick I guess is finding conbination of words.[/color]
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 ("&", "@"), array("a", "b", "c"), array("d", "e",
"f"), ... );
// make array of number
$number = chunk_split((st rval($number), 1, ':');
$array = explode(":",$nu mber);
array_pop($arra y);
// 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.
Comment