Posted By

martin_rusev on 12/15/09


Tagged

transliteration


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

mrgee


Transliteration - Cyrilic to latin and latin to cyrilic


 / Published in: PHP
 

  1. $textcyr="Тествам с кирилица";
  2. $textlat="I pone dotuk raboti!";
  3. $cyr = array('а','б','в','г','д','e','ж','з','и','й','к','л','м','н','о','п','р','с','т','у',
  4. 'ф','х','ц','ч','ш','щ','ъ','ь', 'ю','я','А','Б','В','Г','Д','Е','Ж','З','И','Й','К','Л','М','Н','О','П','Р','С','Т','У',
  5. 'Ф','Х','Ц','Ч','Ш','Щ','Ъ','Ь', 'Ю','Я' );
  6. $lat = array( 'a','b','v','g','d','e','zh','z','i','y','k','l','m','n','o','p','r','s','t','u',
  7. 'f' ,'h' ,'ts' ,'ch','sh' ,'sht' ,'a' ,'y' ,'yu' ,'ya','A','B','V','G','D','E','Zh',
  8. 'Z','I','Y','K','L','M','N','O','P','R','S','T','U',
  9. 'F' ,'H' ,'Ts' ,'Ch','Sh' ,'Sht' ,'A' ,'Y' ,'Yu' ,'Ya' );
  10. $textcyr = str_replace($cyr, $lat, $textcyr);
  11. $textlat = str_replace($lat, $cyr, $textlat);
  12. echo("$textcyr $textlat");

Report this snippet  

You need to login to post a comment.