• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 281
  • Last Modified:

Is there a way to display names and refrences in phonetic alphabet in php?

Hi,
I would like to display reference codes names on our call centre's screens in phonetic alphabet so that they can easily read out the information to the customer.
I was wondering if anyone knows of an easy php plugin that could do this, or even perhaps a font that replaces the letters with their phonetic words?
Thanks
Steven
0
StevenHook
Asked:
StevenHook
  • 2
  • 2
1 Solution
 
fcontrepoisCommented:
Take a look at:
0
 
StevenHookAuthor Commented:
Sorry,
Not that kind of phonetic alphabet. I am looking for the NATO phonetic alphabet:
http://en.wikipedia.org/wiki/NATO_phonetic_alphabet
So the stuff it written as: Tango      Echo      X-ray      Tango
So they can read it correctly to the customer on the phone.


Steven
0
 
darren-w-Commented:
<?php

$a = new to_phon("cab");
echo $a->getPhonetic();
// charlie alpha beta

$a = new to_phon("bee");
echo $a->getPhonetic();

// beta echo echo

class to_phon {

    private $word = "";
    private $alpha = array("a" => "alpha", "b" => "beta", "c" => "charlie", "e" => "echo");

    function __construct($astring) {
        $this->word = $astring;
    }

    private function getSplitstring() {
        return str_split($this->word);
    }

    public function getPhonetic() {
        foreach ($this->getSplitstring() as $aletter) {
            $return.=$this->alpha[$aletter] . " ";
        }
        return $return;
    }

}

?>
0
 
StevenHookAuthor Commented:
Thanks
0
 
darren-w-Commented:
full version excluding numbers

<?php

$a = new to_phon("Phonetic-Alphabet");
echo $a->getPhonetic();
// papa hotel oscar november echo tango india charlie dash alpha lima papa hotel alpha beta echo tango




class to_phon {

    private $word = "";
    private $alpha = array("a" => "alpha", "b" => "beta", "c" => "charlie","d"=>"delta", "e" => "echo","f"=>"foxtrot","g"=> "golf","h"=>"hotel","i"=> "india","j"=> "juliett","k"=>"kilo","l"=>"lima","m"=>"mike","n"=>"november","o"=>"oscar","p"=>"papa","q"=> "quebec","r"=>"romeo","s"=>"sierra","t"=>"tango","u"=>"uniform","v"=>"victor","w"=>"whiskey","x"=>"x-ray","y"=>"yankee","z"=>"zulu","-"=>"dash"); 
    function __construct($astring) {
        $this->word = $astring;
    }

    private function getSplitstring() {
        return str_split(strtolower($this->word));
    }

    public function getPhonetic() {
        foreach ($this->getSplitstring() as $aletter) {
            $return.=$this->alpha[$aletter] . " ";
        }
        return trim($return);
    }

}

?>

Open in new window

0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now