1--TEST-- 2Testing mb_eregi_replace() function 3--SKIPIF-- 4<?php 5if (!extension_loaded('mbstring')) die('skip mbstring not enabled'); 6function_exists('mb_eregi_replace') or die("skip mb_eregi_replace() is not available in this build"); 7?> 8--FILE-- 9<?php 10function do_translit($st) { 11 $replacement = array( 12 "й"=>"i","ц"=>"c","у"=>"u","к"=>"k","е"=>"e","н"=>"n", 13 "г"=>"g","ш"=>"sh","щ"=>"sh","з"=>"z","х"=>"x","ъ"=>"\'", 14 "ф"=>"f","ы"=>"i","в"=>"v","а"=>"a","п"=>"p","р"=>"r", 15 "о"=>"o","л"=>"l","д"=>"d","ж"=>"zh","э"=>"ie","ё"=>"e", 16 "я"=>"ya","ч"=>"ch","с"=>"c","м"=>"m","и"=>"i","т"=>"t", 17 "ь"=>"\'","б"=>"b","ю"=>"yu", 18 "Й"=>"I","Ц"=>"C","У"=>"U","К"=>"K","Е"=>"E","Н"=>"N", 19 "Г"=>"G","Ш"=>"SH","Щ"=>"SH","З"=>"Z","Х"=>"X","Ъ"=>"\'", 20 "Ф"=>"F","Ы"=>"I","В"=>"V","А"=>"A","П"=>"P","Р"=>"R", 21 "О"=>"O","Л"=>"L","Д"=>"D","Ж"=>"ZH","Э"=>"IE","Ё"=>"E", 22 "Я"=>"YA","Ч"=>"CH","С"=>"C","М"=>"M","И"=>"I","Т"=>"T", 23 "Ь"=>"\'","Б"=>"B","Ю"=>"YU", 24 ); 25 26 foreach($replacement as $i=>$u) { 27 $st = mb_eregi_replace($i,$u,$st); 28 } 29 return $st; 30} 31 32mb_regex_encoding('ISO-8859-1'); 33echo do_translit("Пеар"); 34?> 35--EXPECT-- 36Pear 37--CREDITS-- 38Testfest Wuerzburg 2009-06-20 (modified by rui 2011-10-15) 39