Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- const NATOAlphabet = array(
- "A" => "Alfa",
- "B" => "Bravo",
- "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",
- "0" => "Zero",
- "1" => "One",
- "2" => "Two",
- "3" => "Three",
- "4" => "Four",
- "5" => "Five",
- "6" => "Six",
- "7" => "Seven",
- "8" => "Eight",
- "9" => "Nine",
- );
- $string = "Hello this is a Test 058157";
- $string = preg_replace('/\s+/', '', $string); // Removes all spaces
- $string = preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.
- $string = str_split($string);
- $out = "";
- foreach($string as $c){
- $out .= " ".NATOAlphabet[ strtoupper($c) ];
- }
- // Example Output: Hotel Echo Lima Lima Oscar Tango Hotel India Sierra India Sierra Alfa Tango Echo Sierra Tango Zero Five Eight One Five Seven
- echo $out;
- ?>
Add Comment
Please, Sign In to add comment