PHP version of the GBK version of Chinese Simplified, traditional interactive function

Source: Internet
Author: User
Tags filter chr ming ord strlen

Yesterday on Google to find PHP simplified, traditional interactive function.
Reprinted articles are many, but the character chart is not down, can not be used.
Helpless can only write their own, to share with people in need of it.
Note that this is the GBK version!
Limited level, access to PHP is not much, the lack of inevitable

The following is a reference fragment:
Code:
$GB 2312str= ' Ai io Hinder love ao ao dam strike to do trip help tied pound slander to peel full bao Pao, abalone Jackal prepare exhausted the closing of the coin is closed to the change of the braid standard turtle not to have a flat bin bin, and dial the PT to complement the money Ginseng silkworm residue I'm so ashamed. Cang Cang bin Cang astonished side book measurement layer mixed with cicada greedy slander the shovel production of a long time to pay for intestinal factory Chang-chong-chen lining braces to call the correctional Cheng Che-chi, the shame of the teeth blazing a bug in the 踌 to raise silk ugly cupboard kitchen hoe young At the same place, the touch of the sores break through the hammer pure words to give Cong chimneys from the bundle together jump up the wrong to take credit Tan Shan bile mend A Christmas bomb when the party swings the island and pray for the guide to steal Light Deng enemy the ingot set to throw East move the frozen bucket calf to read the betting on the satin team to the ton of blunt the goose the amount to be very hungry er the bait to send the punishment valve to be the same, the 诽 of the rice------------------ Feng-qi-qi-qi-qi-qi-qi-qi-qi-qi-fu-fu-zhi fu re-tie the calcium Gaigan to catch the stalk Gan Gang steel outline hillock Gao pick Pigeon Pavilion Chrome to Shing tribute hook Ditch construction to buy enough cruel gu Guan Guan Hall accustomed to the turtle friend of the Ark of the roll pot Guo Hanhan There crane he Wang hung after a pot of Hu Hu-hua painting, and the bad Huan Huan, the ring also slow change call 痪 Huan Huan yellow lie wave to destroy bribe dirty will be braised in the meat of the goods, the product The hunger and the chicken, the order of the Polar series, the number of thistles, the Ji-ji, the memory of the second-class clip pod checking the base and alkali and picking up the Jiang, reducing the threshold, practicing cheap and seeing the key ship sword money gradually splash the pulp Jiang Oar award to speak sauce gum pouring pride and stirring hinge straightening richest foot dumplings paying off a car compared to the straw-stalk whale by the neck Jing Jing Jing the old colt lifting according to the saw fear of the cuckoo Juan Jie Jie commandment session tight Kam Jin Jin only to make the best Jin Jing Jue jue June Army Chun Kai Shell Class Ken dug the storehouse of the Executioner wide mine open condition deficient kui peep feed burst widen wax Lai Lai lan bar Stop the basket Lan speak browsing lazy cable suck Lao Lok Lei Lei class lei Li Lai li 厉励砾 calendar Li Lian Lian even sickle of pity ripple the curtain gathers the face chain to practice the grain to cool two cures the sea to be tested to be near the neighbour Scale Lin lease age Bell Linglingling collar run Liu Long deaf throat Cage Ridge Long Long Lou Lou Lian Lou Lu Lu Lou you lu Ling bribery LU Record Lu Lu aluminum companion repeatedly worry about filter green Luan Twin Luan Disorderly whirl Lun Lun, Luo luo luo logos gongs luo ma ma yards horse scold? Buy wheat sell mai cheat eels pretty full 谩 cat anchor riveting trade Mody not magnesium door stuffy manganese dream riddle find Power Cotton Burma temple out of the Min Ming and Ming absurd seek mu na na difficult to tickle the brain annoyed and tired of the stuffed birds Nie ni-ning hunting ning twist muddy button new pus-rich malaria Connaught Ouchi fight vomit retting dish pang compensate jet peng cheat drift Frequency The poor Apple on the evaluation of the spread of the spectrum of habitat melancholy umbilical qi ride not to open the air to abandon the pull of lead brazing move to sign modest money pliers dive shallow graben gun choke wall Qiang strong Rob Spade bridge Chowa to sleep light hydrogen dumping in Qing June area of the impoverished body drive caries zygomatic right advised but Magpie really let Rao around hot-thread rong velvet soft sharp run sprinkle SA three umbrella mourning sweep dry wipe screen Shine Shan support damage reward burn Shaoxing credit to set the chance to examine the kidney infiltration sound rope wins the Holy Lion wet On the death of the corpse in the body when the test of the life of the animal pivot book Redemption of the tree vertical number handsome double who is the tax shun Shuo impressive Su although with the sui old sun damaged bamboo shoot shrinkage Lock rex tart Heave-state-held the beach Tan to talk about the Tang hot Tao to make a copy of antimony title Body drawer bar sticking Iron Hall hearing hydrocarbon copper head bald figure Coating Regiment decay shed tuo tuo camel-Bend Bay stubborn million net Wei Wai Wei Wei Pseudo Wei Wei Wen to hear the grain steady ask Urn My scroll vortex, the hole, the black and the dirty, the Wu Wu sacrificeLearn to play the small shrimp under the jurisdiction of the Gorge Xia man narrow mansion scare shovel fresh fiber Xian-Yin Title Leisure show Xianxian Filling Xian-Xian line inlaid Township detailed sound the Xiao Xiao selling the Scorpion association with the threat of harmonic writing Xie Xie Zinc Peacemaker hing because they rust embroidery must Xussu Xu Xu Xuan suspension of Tinea Xuan Learning Xun Xun training hearing the weak pressure raven ducks dumb ya-Yan Yan, Yan Yan 鸯 Yan Proverbs, Yang, Yang itching to raise like Yao Yao Yao remote kiln ballad medicine ye leaf medical iridium yi Yi ant art billion memory righteousness On the yin and the silver drink hidden Sakura Baby Eagle Ching Fluorescent Ying fly to win the domestic carbuncle Dance Yong-yong-you-you-do-do-do-do-do-do-send----------------------------Yue Yue Yue to read cloud Yunyang evenly Yun Yun Christie Halo rhyme Miscellaneous Disaster load save temporary praise dirty cut jujube focus on the case, ze thief gift to the rolling and the gate of the trap of the trap of debt felt to cut the stack battle, Zhang Rose account swelling Zhao Zhe zhen pin Investigation and diagnosis of the town array earned open 狰 competition frame Zheng Certificate Weaving professional paper throwing flag quality stagnation bell end species swelling all over the day suddenly pig all punish candle storing and casting bricks to make a pile of brick and making up a strong-shaped cone, Zhun, and the 邹诅. Drilling and production of the total longitudinal and vertical group  ; 
$BIG 5str= ' 皚 藹 翺 襖 Olympic dams strike to issue to help bind the pound 絆 謗 saturated stripped lifetime Bob 鋇 reserve 狽 pen after shot the awareness change debate 辮 Mark 鼈 癟 Endangered riverwalk Waffles and 擯 flick 缽 Platinum connected ashamed sad brightening flies hatch barn 滄 toilet and 詫 攙 摻 cicadas 饞 讒 dogfight a spade field to be in the same------------------makes The piles broke creative cylinders pure Dolcevita resignation onion from the bush Chimney Compact The fault of the 躥 竄 憚, the 搗, The Pirate Beacon, Tang enemy 滌, 締 upside, cushion, fishing, fold top 錠 subscribe to building freeze 犢 plated forgings ribbons troops confirmed tons capture dull abortion the goose 訛 the bait to be punished 貳 the valve of the 琺 and the 礬 of the trouble 釩 the trafficking of the flight Lyon and 誹 Fung Sewing ironic Phoenix radiation were the 訃 bondage tetrahydrate to do so to 稈 贛 the of the Car, Longgang, 臯 Hao of the same stranded chrome to the 龔 鞏 hook communication structure 蠱 care about the museum's habits 剮 wide silicon consistent turtle orbit 閨 tricks 劊 輥 rolling pan country hackers Korean Hans 閡 鶴 Hubbard Huan Pot protect 滬 rushing the plan of the paralyzed Longoza to destroy 渙 bribery the 穢 will 燴 and conceal 誨 to draw 葷 渾 to attack the volume of accident Hunger 譏 Chicken Grade Warrant Extreme editor 薊, and pods cheeks Steve Potassium, and the hardness of destroyers 緘 Cocoon Berberine alkaline chosen pick simple 儉 recommended threshold draw practices cheap See key battleship Sword 餞 Splash 澗 will plasma 蔣 plastic watering proud delicate stirring 鉸 矯 僥 leg 餃 paying 絞 vehicles 稭 campaign penis The old neck 痙 the tangled the 廄 of the campaign 駒 and then saw the Huan Silk commandments to the end She, Antony to the Army 駿 Open the shell course settlements chickens copied library pants boast snobbish wide mines 曠 scenario thanks 巋 Glimpse Feedback breakdown wide fence intercept basketball 闌 瀾 讕 攬 Browse lazy cables torn abused 撈 labor 澇 music beam softball tears fence away She calendars asphalt, scythe poor ripples curtain 斂 facial link Alchemy Food 遼 鐐 Scales 凜, 賃 fanling--distillation-Chris Lau Deaf, the throat-cage--monopolistic-a-, and the- Paul Donkey Lu Aluminum Couples floundering Hamamelis consider filter green 巒 攣 孿 灤 Chaos stall London Rurunrun boundary 綸 theory of Prime Robert Gong 籮 騾 mom, 螞蟻, scoid? To buy a hiding 饅 謾 road cat 鉚, and not magnesium dream mystery the 覓 冪 sponge Myanmar Temple Extinction Mercy 閩 resonance motto absurd conspiracy acre sodium harass 餒 the 膩 the of the 攆 the birds linen stuffed 聶 Rodents The 鑷 鎳 the Lemonade 獰 The ning of the new screwed the concentrated agriculture 濘 the European 膿 malaria The Seagull 毆 the 嘔 Poor apple thin Songkran Aleppo Poker cobblestone Pot recipe habitat 淒 belly the wouldn't the 訖 the 扡 to lead 釺 the lead sign humility money bleeder potential shallow condemnation graben gun 嗆 wall 薔 Rob 鍬 bridge Joe 僑 dead tricks theft Chin dear bedroom light hydrogen 頃 Please celebrate Vigénère Poor District Torso TD 齲 Zygomatic rights advise but Choquette make spare disturbed by sewing honor fuzzy the soft sharp rinjita sprinkled gills umbrella harassment the Shibuya to kill yarn the filter to have a 曬 陝 the 贍 to be burned 繕 to 賒 the deterrent to trial gentleman 嬸 In the erosion of the corpse, the knowledge of the longevity hubs The salvation of the erector spinae of handsome flashing 飼 towering 慫 celebrate courts recite 擻 the Soviet serious 綏 grandchildren 筍-trivial-獺 lock 撻 altar Tantra talk about Marvel soup hot Wentao 縧 discussion burn 謄 the subject 銻 to listen drawer bronze head 烴 paint groups bald 頹 off transformation Ostrich 馱 Camel Elliptical orbits 窪 Bend Bay sock The internet is friend 濰 great 葦 Wen Wen's stability difference. 撾 蝸 Swirl Hive The oooo tungsten Uruguayan pollution 誣 no 蕪 Wu Hollywood fog mission wideDrama Lobster 轄 Strait Batman narrow building scare 鍁 fiber Salt 謙賢 title did nothing the present filling envy the constitution compartment 鑲 Depression Arrogant marketing tsunami Die gimp Harmony write 瀉 thank Firebrake Happy provocative 洶 Rusty Embroidery The suspense 癬 絢 hoon Untamed training Jefferson pressure Opium duck dumb surprise oxen smoke salt severe 閻 and 硯 諺 鴦 experience Yang 瘍 itch 瑤, Yau, 窯, and all of the medical and medical and industrial-heritage The 繹 shade the cherry Baby Eagle 纓 Crystal the 熒 to win flies stand yo maid and 癰 鈾 the 輿 fishing entertainment and the language of the island, harness 鴛 depths, 轅 Park members, Keys Chow Cantonese, 鄖 evenly crater 蘊 醞 dizzy, and rhythmic, 攢 the dirty 贓-鑿 竈, sepia donors Yozakku 劄 gin 鍘 閘 bars scams fasting 氈 盞 cutting 輾 brand and Hoteis bloomed increases accounts Town struggle Open My 猙 frame Cheng certified sincere dropped flag and 滯 the end minutes swelling crush axis 謅 wrinkled the pork day 誅 candles 矚 The Testament cast architecture stationed dedicated brick stake's makeup cone 贅 crashed 綴 諄 The 濁 of the information 漬 complex 鄒 group '   ;
function GetChar ($STR, $pos) {
For ($i =0 $i <=strlen ($str);) {
if (Ord ($str [$i]) <=128) {
if ($pos = = $i) {
return $str [$i];
}
$i + +;
}else{
if ($pos = = $i) {
return $str [$i]. $str [$pos +1];
}elseif ($pos = = $i + 1) {
return $STR [$pos-1]. $str [$pos];
}
$i +=2;
}
}
return-1;
}
function Getcharpos ($STR, $CHR) {
For ($i =0 $i <strlen ($str);) {
if (Ord ($CHR) <=128) {
if ($CHR = = $str [$i]) {
return $i;
}
$i +=1;
}else{
if ($CHR = = $str [$i]. $str [$i +1]) {
return $i;
}
$i +=2;
}

}
return-1;
}

function traditionalized ($text) {
Global $GB 2312Str;
Global $BIG 5Str;
$rText = "";
For ($i =0 $i <=strlen ($text);) {
if (Ord ($text [$i]) <=128) {
$temp =getchar ($text, $i);
$i + +;
}else{
$temp =getchar ($text, $i);
$i +=2;
}
if (($pos = Getcharpos ($GB 2312Str, $temp))!=-1) {
$rText. = GetChar ($BIG 5Str, $pos);

}else{
$rText. = $temp;
}
}
return $rText;
}
function simplified ($text) {
Global $GB 2312Str;
Global $BIG 5Str;
$rText = "";
For ($i =0 $i <=strlen ($text);) {
if (Ord ($text [$i]) <=128) {
$temp =getchar ($text, $i);
$i + +;
}else{
$temp =getchar ($text, $i);
$i +=2;
}
if (($pos = Getcharpos ($BIG 5Str, $temp))!=-1) {
$rText. = GetChar ($GB 2312Str, $pos);

}else{
$rText. = $temp;
}
}
return $rText;
}
echo traditionalized ("Classic Forum");//Traditional
Echo simplified ("The Theory of Altar");//Simplified



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.