<!DOCTYPE html>
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" />
</head>
<body>
<?php
// First things first
date_default_timezone_set('Europe/Athens');

mb_internal_encoding("UTF-8");
mb_substitute_character("none"); 

if (isset($_REQUEST['FHMS11'])) {
   print_hex($_REQUEST['FHMS11']);
   
   $s11=mb_strtoupper(trim($_REQUEST['FHMS11'])); 
   print_hex($s11);
   
   $some_eng=false;
   for ($i=0;$i<3;$i++) {
      if (is_english(mb_substr($s11,$i,1))) {
         $some_eng=true;
         break;
      }
   }
   echo "SOME_ENG=".($some_eng?"true":"false")."<br>";   
   
   $s11 = eng_to_gr($s11);
   print_hex($s11);
   
   $s11 = gr_to_eng($s11);
   print_hex($s11);
   
   echo "<hr>";
}
?>
<form>
FHM: <input type=text name="FHMS11"> <input type=submit value="Query">
</form>
<?php
//--------------------------------------
function is_english($src)
{
   static $eng_only=array('Q', 'W', 'R', 'U', 'S', 'D', 'F', 'G', 'J', 'L', 'C', 'V');
   
   //return in_array($src, $eng_only);
   
   if (!in_array($src, $eng_only)) {
      echo "$src not in array<br>";
      return false;
   }
   else {
      return true;
   }
}
//--------------------------------------
function print_hex($s11)
{
   echo "$s11 ";
   $l=strlen($s11);
   for ($i=0;$i<$l;$i++) {
      printf("%02x ", ord($s11{$i}) );
   }
   echo "<br>";
}
//--------------------------------------
function gr_to_eng($src)
{
   static $grIN=array('Α', 'Β', 'Ε', 'Ζ', 'Η', 'Ι', 'Κ', 'Μ', 'Ν', 'Ο', 'Ρ', 'Τ', 'Υ', 'Χ');
   static $enOUT=array('A', 'B', 'E', 'Z', 'H', 'I', 'K', 'M', 'N', 'O', 'P', 'T', 'Y', 'X');
    
   return str_replace( $grIN, $enOUT, $src); 
}
//--------------------------------------
function eng_to_gr($src)
{
   static $enIN=array('A', 'B', 'E', 'Z', 'H', 'I', 'K', 'M', 'N', 'O', 'P', 'T', 'Y', 'X');
   static $grOUT=array('Α', 'Β', 'Ε', 'Ζ', 'Η', 'Ι', 'Κ', 'Μ', 'Ν', 'Ο', 'Ρ', 'Τ', 'Υ', 'Χ');
    
   return str_replace( $enIN, $grOUT, $src); 
}
?>
</body>
</html>