Hi.

I tried to write a little tool which allows you to
translate your phone number into words.

For example:
22 -> aa or ab or ba or bb.

I know there would be alot of combinations for
a longer number, it connected to a dictionary
service, it could possibly find real words...

I tried to do it, but it is more complex than I
thought in the beginning. So, if you have seen
some code snippets for this or have an idea
how to program it, please post.

Thank you!

Fox

    I'd probably try going at it from the other side. Take a dictionary and convert all words to a numeric representation (and store it for future use of course), and then do comparisons based on the digits.

      Or go one step further:

      Split all these words into individual numbers, and insert then in a database, say for the first 15 letters, each number a colum.

      then just select from...

      If you do not get any matches, try the first 14, 13, 12, .. untill you get matches against the phone number

        This might work to generate 'em..

        <?php
        
        $phone_number = (isset($_GET['number']) && is_numeric($_GET['number'])) ? $_GET['number'] : 4405608977;
        $phone_letters = array(0, 1, 2 => array("a", "b", "c"), 3 => array("d", "e", "f"), 4 => array("g", "h", "i"), 5 => array("j", "k", "l"), 6 => array("m", "n", "o"), 7 => array("p", "q", "r", "s"), 8 => array("t", "u", "v"), 9 => array("w", "x", "y", "z"));
        
        $numbers = preg_split("//", $phone_number, -1, PREG_SPLIT_NO_EMPTY);
        
        foreach($numbers as $num)
        {
          if(in_array($num, array("0", "1"))) echo $num;
          else echo @$phone_letters[$num][rand(0, count($phone_letters[$num]))];
        }
        
        ?>
        

        🙂

          Wow, thank you.

          Even it "only" shows one possibility,
          it's way shorter than my first funtions.

          I try to change the code for my needs.

          Thank you again!

          Fox

            Write a Reply...