Php Chinese traditional and simplified Chinese conversion method

Source: Internet
Author: User
This article mainly introduces the methods for converting php traditional Chinese and Simplified Chinese, and involves the use of the array simplified and traditional Chinese comparison tables in php, which has some reference value, for more information, see the examples in this article. Share it with you for your reference. The specific analysis is as follows:

The following code uses the traditional Chinese and Simplified Chinese character libraries to convert traditional Chinese and Simplified Chinese characters.

The code is as follows:


<? Php
Class utf8_chinese
{
Private $ utf8_gb2312;
Private $ utf8_big5;
Private $ data;
Public function _ construct ($ data ){
$ This-> utf8_gb2312 = $ data ['SIM '];
$ This-> utf8_big5 = $ data ['tra '];
}
Public function gb2312_big5 ($ str ){
$ Str_t = '';
$ Len = strlen ($ str );
$ A = 0;
While ($ a <$ len ){
If (ord ($ str {$ a}) >=224 & ord ($ str {$ a}) <= 239 ){
If ($ temp = strpos ($ this-> utf8_gb2312, $ str {$ }. $ str {$ a + 1 }. $ str {$ a + 2 }))! = False ){
$ Str_t. = $ this-> utf8_big5 {$ temp}. $ this-> utf8_big5 {$ temp + 1}. $ this-> utf8_big5 {$ temp + 2 };
$ A + = 3;
Continue;
}
}
$ Str_t. = $ str {$ };
$ A + = 1;
}
Return $ str_t;
}
Public function big5_gb2312 ($ str ){
$ Str_t = '';
$ Len = strlen ($ str );
$ A = 0;
While ($ a <$ len ){
If (ord ($ str {$ a}) >=224 & ord ($ str {$ a}) <= 239 ){
If ($ temp = strpos ($ this-> utf8_big5, $ str {$ }. $ str {$ a + 1 }. $ str {$ a + 2 }))! = False ){
$ Str_t. = $ this-> utf8_gb2312 {$ temp}. $ this-> utf8_gb2312 {$ temp + 1}. $ this-> utf8_gb2312 {$ temp + 2 };
$ A + = 3;
Continue;
}
}
$ Str_t. = $ str {$ };
$ A + = 1;
}
Return $ str_t;
}
}
$ _ UTF8_TRA = array (
'SIM '=> 'wan and the ugly professional Cong Dong Si lost two strict funeral tickets. Fengfeng is standing for Liju? Yiwu Leqiao Xi Township book purchase chaos in the loss of cloud Imaya production mu Qinxi only from the Lun warehouse, the high-price crowd will attack the umbrella Wei Chuan and hurt the Lun Peng pseudo queue, the rest of the Commission, the Xia, the investigation side, the overseas Chinese friends, and the two Lihu debts qingxiao yu chu yu er Yu Dang Lan Guan xingz animal maintenance gang book write Junnong Zun Feng Zheng Jing Leng Ling together a few Phoenix with Kai hit liu zhengchuang, Liu zhengchuang, delete, do not, please, try, please wei is still busy in the office of the factory, and he is tired of being overwhelmed by the pressure of the kitchen, the city vomit, please refer to the following: when the hacker sprayed himself, he grayed out and yelled at him. when the Communist Youth League Park was around, the guomu Yuanyuan Holy Land farm was closed, and the blocks were broken, and the dam and dock Graves fell onto the ridge, and the land was under the same kind of chalk. pad your hair and paste your hair in the upper-right corner of the wall and the upper-right Shell pot. lou ya, Jiao Yu, Yu, Yu Ying, Yu, Yu, Miao, Sun Xuexiao, Ning Bao, Shi Chong, xian gong, Kuan bin, sleeping on searching for and directing the dead layer-7 senior member of the Yiyu Township-old Qigang Shaoyi Landao Ling Yuexiao qingtongtongtongxia Qingting Zhuyun Yunqi the teacher's tent curtain was taken with frames to help the teacher prepare the power of the Lord and the wide Village Qinglu library should be under the temple Pang waste when the different Zhang Mi bending and playing strong when the recording Yan Che the diameter of Yu Yi Yu worried about the state of the yellow, yellow I am so angry that I would like to block myself from being lazy, busy, and busy. unscrew and choose to throw, and throw, throw, and throw. shake your hands, shake your hands, shake your hands, gather your enemies, and compress your data into your ears. when you break the old days, you will see the sun, Xiao, dizzy, and Hui. right bar to Yang Xiaojie extremely structure Shu Zao Shu Yu gun Feng Xiao cabinet comment gate standard stack comment wide range of oak column tree habitat sample when the radial foot gear qiao Hua Yu paddling pile Dream Ghost detection zookeeper loudid zookeeper horizontal Sakura published cupboard zookeeper Huan Yu Ou J Yi residual when the hub is destroyed, the gas hydrogen and argon in the air are broken down. ze Jing Jie sprinkling WA Shile slurry pouring zookeeper turbidity test zookeeper thick zookeeper Tu Yongtao tailuo zookeeper vortex tailuo polyester Runjian up the lake Yuanyuan Tai the water in Wenyou Bay is full of water, water the disaster-stricken cancan furnace stew Wei Yi points refining and rotten hydrocarbon candle smoke annoying burn Ye stew hot ashes hot Huan Yi Ye xiao, Xiao, Xiao Shi, Xiao Yu, Xiao Ma, Wei Huan, Xiao Xi, Xiao Yu xuanjicang Luocheng electric painting Changyi domain Medicine malaria selection sore crazy blister Yellow yundun salt monitoring and anti-theft plate yundun lu Chan from the bald stalk kind of product said Lu Yi tax stability poor stealing Yao Wei Dou Yan vertical competing lettuce the pen was written in a cage, and the screen was sifted. the Zheng was signed and signed in a simplified manner. about the grade of Yarn Yun when the students were tied by the Velvet knot, the hacker was painted to the hacker, and the system was twisted, and the silk was embroidered. rope dimension cotton silk Silk all the information in the middle of the market is always around, and all the information in the middle of the market is reduced. shame and shame, deaf job, Union, Cong Su, intestinal skin, kidney swelling, threat, gallbladder, Shengyu, titanium gum, vein, dirty umbilical, brain, pus, feet, removal of sputum, face, marinate, and palate yi Teng Yu ship cabin Yan Yi festival Wu Lu yi si Cang Su Yun Ping Jing ling Xiaodong Rong Yu Ying Yu Lu Ying Xiao Sa Ling Yu Jiang Yu ranjus yundun body wax flies and moles fill in the title of a pair of tops, yellow you can see your questions and suggestions, and you can see your tips and suggestions. on legal proceedings: an investigation of evidence, explanation, and evaluation of evidence, fraud, litigation, and diagnosis of fraud please refer to the following link for more information: Please refer to the following statements for further guidance: seeking for a lie and a cool voice means that the hacker can understand the riddle of the hacker, the hacker, and the hacker. yu Gu Yu Bei Zhen negative Gong financial responsibility Xian defeat account goods quality vendors greedy poor purchase store through two cheap Xiao posted expensive loan and trade fee he Yu thieves Jia bribery I was lucky enough to pay gambling prizes, and I was lucky enough to pay for it. fan Yue's rolling-rolling I think it's easy to add a pair of workers to the roll rim of a pair of workers. the migration of liaodas to the migration is still far away. even the late tracking is suitable for the selection of poor delivery and the legacy of Deng Xiaoyu's mailbox and the adjacent Yu Xiaoyu Zheng Weiyu's zookeeper and zookeeper's soy sauce. zookeeper Shiri Shixiao Xiaojian (Ru, r, r, o, T, O, O, T, O tungsten-hook-and-wire-hook-and-trigger-RH, er, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 the ingot Key saw manganese oxide was used as a cutting-edge tool. zookeeper and zookeeper. during the peak hours, the congestion threshold was reached. team Yang Yin stage Lu Yu Chen Yu Shaanxi province insurance with hidden Li Yan difficult young Xiao Wu Yan Jing Wei Ren Yi Han Yu Tao on the top of the Yun page, the top of the line is to be followed by a stubborn gu Dun, and the top of the line is to receive a wide range of pre-skull neck, cheek, and Chin Yi frequency. the amount of apsaradb for hybriddb for MySQL. full-fed wonton bait ra drive your horse and drive your horse. cool zookeeper hip and five zookeeper salmon gizzard inspecies and inspecies inspector when the birds of the Rooster have been running, the birds of the Rooster have been running. there are a huge number of birds in the house. zhi's consulting team fan song didn't try it and won't be idle ',
'Tra '=> 'between Alibaba Cloud and Alibaba Cloud, there are two major reasons why Alibaba Cloud is making sense. please try again later. the Asian production industry has announced that Alibaba Cloud's leading group members have been using Alibaba Cloud products to improve their performance. please refer to the following link for more information: please refer to the following documents for more information: there is a huge amount of traffic in our region. there are just a few large numbers of small numbers of bytes of data. after the change, why does the website fail to be updated? have you heard that the website administrator has been notified? there have been several large numbers of small numbers of Chinese there is a huge amount of pressure on the market. in addition, the number of concurrent users in the website has reached a certain number of Chinese characters. I have been reading this article for some time. please refer to the following link for more information: please refer to the following link for more information: I would like to announce that my website has been released soon. during the battle, there will be two major challenges: please refer to the following link for more information: when there is no such change, there will be a number of unauthorized users who have been authorized to access the website. please refer to the following link for more information: please refer to the following link for more information: there has been a number of attacks in the market. There has been no improvement in the market. please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please try again later. please try again later. there have been many problems in the power supply industry. please refer to the following link for more information: please refer to the following link for more information: there are two major causes for this problem: please refer to the following table for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following documents for more information: I think it is highly recommended that our customers have already been connected to Alibaba Cloud, and our customers will be highly aware of this problem. I may comment on the legal representative's certificate provided by the legal representative of the legal representative. please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: why? alibaba Cloud's website is based on Alibaba Cloud's website. there will be a number of large numbers of small numbers of vehicles. please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: there are two major reasons for this problem: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: there are two major issues in this regard: why? please refer to the following link for more information: there have been several attempts to improve the performance of these products. please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please refer to the following link for more information: please wait until there are too many attempts when there are too many attempts ',
);
Function cns ($ str ){
Global $ _ UTF8_TRA;
$ Chinese = new utf8_chinese ($ _ UTF8_TRA );
$ Str_big5 = $ chinese-> gb2312_big5 ($ str );
Return $ str_big5;
}

I hope this article will help you with php programming.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.