epinyin.php 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <?php
  2. //返回拼音
  3. function rpyd(){
  4. $d=array(
  5. array("a",-20319),
  6. array("ai",-20317),
  7. array("an",-20304),
  8. array("ang",-20295),
  9. array("ao",-20292),
  10. array("ba",-20283),
  11. array("bai",-20265),
  12. array("ban",-20257),
  13. array("bang",-20242),
  14. array("bao",-20230),
  15. array("bei",-20051),
  16. array("ben",-20036),
  17. array("beng",-20032),
  18. array("bi",-20026),
  19. array("bian",-20002),
  20. array("biao",-19990),
  21. array("bie",-19986),
  22. array("bin",-19982),
  23. array("bing",-19976),
  24. array("bo",-19805),
  25. array("bu",-19784),
  26. array("ca",-19775),
  27. array("cai",-19774),
  28. array("can",-19763),
  29. array("cang",-19756),
  30. array("cao",-19751),
  31. array("ce",-19746),
  32. array("ceng",-19741),
  33. array("cha",-19739),
  34. array("chai",-19728),
  35. array("chan",-19725),
  36. array("chang",-19715),
  37. array("chao",-19540),
  38. array("che",-19531),
  39. array("chen",-19525),
  40. array("cheng",-19515),
  41. array("chi",-19500),
  42. array("chong",-19484),
  43. array("chou",-19479),
  44. array("chu",-19467),
  45. array("chuai",-19289),
  46. array("chuan",-19288),
  47. array("chuang",-19281),
  48. array("chui",-19275),
  49. array("chun",-19270),
  50. array("chuo",-19263),
  51. array("ci",-19261),
  52. array("cong",-19249),
  53. array("cou",-19243),
  54. array("cu",-19242),
  55. array("cuan",-19238),
  56. array("cui",-19235),
  57. array("cun",-19227),
  58. array("cuo",-19224),
  59. array("da",-19218),
  60. array("dai",-19212),
  61. array("dan",-19038),
  62. array("dang",-19023),
  63. array("dao",-19018),
  64. array("de",-19006),
  65. array("deng",-19003),
  66. array("di",-18996),
  67. array("dian",-18977),
  68. array("diao",-18961),
  69. array("die",-18952),
  70. array("ding",-18783),
  71. array("diu",-18774),
  72. array("dong",-18773),
  73. array("dou",-18763),
  74. array("du",-18756),
  75. array("duan",-18741),
  76. array("dui",-18735),
  77. array("dun",-18731),
  78. array("duo",-18722),
  79. array("e",-18710),
  80. array("en",-18697),
  81. array("er",-18696),
  82. array("fa",-18526),
  83. array("fan",-18518),
  84. array("fang",-18501),
  85. array("fei",-18490),
  86. array("fen",-18478),
  87. array("feng",-18463),
  88. array("fo",-18448),
  89. array("fou",-18447),
  90. array("fu",-18446),
  91. array("ga",-18239),
  92. array("gai",-18237),
  93. array("gan",-18231),
  94. array("gang",-18220),
  95. array("gao",-18211),
  96. array("ge",-18201),
  97. array("gei",-18184),
  98. array("gen",-18183),
  99. array("geng",-18181),
  100. array("gong",-18012),
  101. array("gou",-17997),
  102. array("gu",-17988),
  103. array("gua",-17970),
  104. array("guai",-17964),
  105. array("guan",-17961),
  106. array("guang",-17950),
  107. array("gui",-17947),
  108. array("gun",-17931),
  109. array("guo",-17928),
  110. array("ha",-17922),
  111. array("hai",-17759),
  112. array("han",-17752),
  113. array("hang",-17733),
  114. array("hao",-17730),
  115. array("he",-17721),
  116. array("hei",-17703),
  117. array("hen",-17701),
  118. array("heng",-17697),
  119. array("hong",-17692),
  120. array("hou",-17683),
  121. array("hu",-17676),
  122. array("hua",-17496),
  123. array("huai",-17487),
  124. array("huan",-17482),
  125. array("huang",-17468),
  126. array("hui",-17454),
  127. array("hun",-17433),
  128. array("huo",-17427),
  129. array("ji",-17417),
  130. array("jia",-17202),
  131. array("jian",-17185),
  132. array("jiang",-16983),
  133. array("jiao",-16970),
  134. array("jie",-16942),
  135. array("jin",-16915),
  136. array("jing",-16733),
  137. array("jiong",-16708),
  138. array("jiu",-16706),
  139. array("ju",-16689),
  140. array("juan",-16664),
  141. array("jue",-16657),
  142. array("jun",-16647),
  143. array("ka",-16474),
  144. array("kai",-16470),
  145. array("kan",-16465),
  146. array("kang",-16459),
  147. array("kao",-16452),
  148. array("ke",-16448),
  149. array("ken",-16433),
  150. array("keng",-16429),
  151. array("kong",-16427),
  152. array("kou",-16423),
  153. array("ku",-16419),
  154. array("kua",-16412),
  155. array("kuai",-16407),
  156. array("kuan",-16403),
  157. array("kuang",-16401),
  158. array("kui",-16393),
  159. array("kun",-16220),
  160. array("kuo",-16216),
  161. array("la",-16212),
  162. array("lai",-16205),
  163. array("lan",-16202),
  164. array("lang",-16187),
  165. array("lao",-16180),
  166. array("le",-16171),
  167. array("lei",-16169),
  168. array("leng",-16158),
  169. array("li",-16155),
  170. array("lia",-15959),
  171. array("lian",-15958),
  172. array("liang",-15944),
  173. array("liao",-15933),
  174. array("lie",-15920),
  175. array("lin",-15915),
  176. array("ling",-15903),
  177. array("liu",-15889),
  178. array("long",-15878),
  179. array("lou",-15707),
  180. array("lu",-15701),
  181. array("lv",-15681),
  182. array("luan",-15667),
  183. array("lue",-15661),
  184. array("lun",-15659),
  185. array("luo",-15652),
  186. array("ma",-15640),
  187. array("mai",-15631),
  188. array("man",-15625),
  189. array("mang",-15454),
  190. array("mao",-15448),
  191. array("me",-15436),
  192. array("mei",-15435),
  193. array("men",-15419),
  194. array("meng",-15416),
  195. array("mi",-15408),
  196. array("mian",-15394),
  197. array("miao",-15385),
  198. array("mie",-15377),
  199. array("min",-15375),
  200. array("ming",-15369),
  201. array("miu",-15363),
  202. array("mo",-15362),
  203. array("mou",-15183),
  204. array("mu",-15180),
  205. array("na",-15165),
  206. array("nai",-15158),
  207. array("nan",-15153),
  208. array("nang",-15150),
  209. array("nao",-15149),
  210. array("ne",-15144),
  211. array("nei",-15143),
  212. array("nen",-15141),
  213. array("neng",-15140),
  214. array("ni",-15139),
  215. array("nian",-15128),
  216. array("niang",-15121),
  217. array("niao",-15119),
  218. array("nie",-15117),
  219. array("nin",-15110),
  220. array("ning",-15109),
  221. array("niu",-14941),
  222. array("nong",-14937),
  223. array("nu",-14933),
  224. array("nv",-14930),
  225. array("nuan",-14929),
  226. array("nue",-14928),
  227. array("nuo",-14926),
  228. array("o",-14922),
  229. array("ou",-14921),
  230. array("pa",-14914),
  231. array("pai",-14908),
  232. array("pan",-14902),
  233. array("pang",-14894),
  234. array("pao",-14889),
  235. array("pei",-14882),
  236. array("pen",-14873),
  237. array("peng",-14871),
  238. array("pi",-14857),
  239. array("pian",-14678),
  240. array("piao",-14674),
  241. array("pie",-14670),
  242. array("pin",-14668),
  243. array("ping",-14663),
  244. array("po",-14654),
  245. array("pu",-14645),
  246. array("qi",-14630),
  247. array("qia",-14594),
  248. array("qian",-14429),
  249. array("qiang",-14407),
  250. array("qiao",-14399),
  251. array("qie",-14384),
  252. array("qin",-14379),
  253. array("qing",-14368),
  254. array("qiong",-14355),
  255. array("qiu",-14353),
  256. array("qu",-14345),
  257. array("quan",-14170),
  258. array("que",-14159),
  259. array("qun",-14151),
  260. array("ran",-14149),
  261. array("rang",-14145),
  262. array("rao",-14140),
  263. array("re",-14137),
  264. array("ren",-14135),
  265. array("reng",-14125),
  266. array("ri",-14123),
  267. array("rong",-14122),
  268. array("rou",-14112),
  269. array("ru",-14109),
  270. array("ruan",-14099),
  271. array("rui",-14097),
  272. array("run",-14094),
  273. array("ruo",-14092),
  274. array("sa",-14090),
  275. array("sai",-14087),
  276. array("san",-14083),
  277. array("sang",-13917),
  278. array("sao",-13914),
  279. array("se",-13910),
  280. array("sen",-13907),
  281. array("seng",-13906),
  282. array("sha",-13905),
  283. array("shai",-13896),
  284. array("shan",-13894),
  285. array("shang",-13878),
  286. array("shao",-13870),
  287. array("she",-13859),
  288. array("shen",-13847),
  289. array("sheng",-13831),
  290. array("shi",-13658),
  291. array("shou",-13611),
  292. array("shu",-13601),
  293. array("shua",-13406),
  294. array("shuai",-13404),
  295. array("shuan",-13400),
  296. array("shuang",-13398),
  297. array("shui",-13395),
  298. array("shun",-13391),
  299. array("shuo",-13387),
  300. array("si",-13383),
  301. array("song",-13367),
  302. array("sou",-13359),
  303. array("su",-13356),
  304. array("suan",-13343),
  305. array("sui",-13340),
  306. array("sun",-13329),
  307. array("suo",-13326),
  308. array("ta",-13318),
  309. array("tai",-13147),
  310. array("tan",-13138),
  311. array("tang",-13120),
  312. array("tao",-13107),
  313. array("te",-13096),
  314. array("teng",-13095),
  315. array("ti",-13091),
  316. array("tian",-13076),
  317. array("tiao",-13068),
  318. array("tie",-13063),
  319. array("ting",-13060),
  320. array("tong",-12888),
  321. array("tou",-12875),
  322. array("tu",-12871),
  323. array("tuan",-12860),
  324. array("tui",-12858),
  325. array("tun",-12852),
  326. array("tuo",-12849),
  327. array("wa",-12838),
  328. array("wai",-12831),
  329. array("wan",-12829),
  330. array("wang",-12812),
  331. array("wei",-12802),
  332. array("wen",-12607),
  333. array("weng",-12597),
  334. array("wo",-12594),
  335. array("wu",-12585),
  336. array("xi",-12556),
  337. array("xia",-12359),
  338. array("xian",-12346),
  339. array("xiang",-12320),
  340. array("xiao",-12300),
  341. array("xie",-12120),
  342. array("xin",-12099),
  343. array("xing",-12089),
  344. array("xiong",-12074),
  345. array("xiu",-12067),
  346. array("xu",-12058),
  347. array("xuan",-12039),
  348. array("xue",-11867),
  349. array("xun",-11861),
  350. array("ya",-11847),
  351. array("yan",-11831),
  352. array("yang",-11798),
  353. array("yao",-11781),
  354. array("ye",-11604),
  355. array("yi",-11589),
  356. array("yin",-11536),
  357. array("ying",-11358),
  358. array("yo",-11340),
  359. array("yong",-11339),
  360. array("you",-11324),
  361. array("yu",-11303),
  362. array("yuan",-11097),
  363. array("yue",-11077),
  364. array("yun",-11067),
  365. array("za",-11055),
  366. array("zai",-11052),
  367. array("zan",-11045),
  368. array("zang",-11041),
  369. array("zao",-11038),
  370. array("ze",-11024),
  371. array("zei",-11020),
  372. array("zen",-11019),
  373. array("zeng",-11018),
  374. array("zha",-11014),
  375. array("zhai",-10838),
  376. array("zhan",-10832),
  377. array("zhang",-10815),
  378. array("zhao",-10800),
  379. array("zhe",-10790),
  380. array("zhen",-10780),
  381. array("zheng",-10764),
  382. array("zhi",-10587),
  383. array("zhong",-10544),
  384. array("zhou",-10533),
  385. array("zhu",-10519),
  386. array("zhua",-10331),
  387. array("zhuai",-10329),
  388. array("zhuan",-10328),
  389. array("zhuang",-10322),
  390. array("zhui",-10315),
  391. array("zhun",-10309),
  392. array("zhuo",-10307),
  393. array("zi",-10296),
  394. array("zong",-10281),
  395. array("zou",-10274),
  396. array("zu",-10270),
  397. array("zuan",-10262),
  398. array("zui",-10260),
  399. array("zun",-10256),
  400. array("zuo",-10254)
  401. );
  402. return $d;
  403. }
  404. function g($num){
  405. $d=rpyd();
  406. if($num>0&&$num<160)
  407. {
  408. return chr($num);
  409. }
  410. elseif($num<-20319||$num>-10247)
  411. {
  412. return "";
  413. }
  414. else
  415. {
  416. for($i=count($d)-1;$i>=0;$i--){if($d[$i][1]<=$num)break;}
  417. return $d[$i][0];
  418. }
  419. }
  420. function c($str){
  421. $ret="";
  422. for($i=0;$i<strlen($str);$i++)
  423. {
  424. $p=ord(substr($str,$i,1));
  425. if($p>160)
  426. {
  427. $q=ord(substr($str,++$i,1));
  428. $p=$p*256+$q-65536;
  429. }
  430. $ret.=g($p);
  431. }
  432. return $ret;
  433. }
  434. ?>