Annotation of embedaddon/php/ext/mbstring/tests/mb_eregi_replace.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Testing mb_eregi_replace() function
3: --SKIPIF--
4: <?php
5: if (!extension_loaded('mbstring')) die('skip mbstring not enabled');
6: function_exists('mb_eregi_replace') or die("skip mb_eregi_replace() is not available in this build");
7: ?>
8: --FILE--
9: <?php
10: function 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:
1.1.1.2 ! misho 32: echo do_translit("Пеар");
1.1 misho 33: ?>
34: --EXPECT--
1.1.1.2 ! misho 35: Pear
1.1 misho 36: --CREDITS--
1.1.1.2 ! misho 37: Testfest Wuerzburg 2009-06-20 (modified by rui 2011-10-15)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>