百独托管7500 紫田网络超高转化播放器收cps[推荐]速盾CDN 免实名免备防屏蔽阿里云 爆款特卖9.9元封顶提升alexa、IP流量7Q5团队
【腾讯云】中小企福利专场【腾讯云】多款产品1折起高防 随时退换 好耶数据小飞国外网赚带你月入万元炎黄网络4H4G10M 99每月
香港带宽CN2/美国站群优惠中客数据中心 服务器租用联盟系统移动广告平台 中易企业专场腾讯云服务器2.5折九九数据 工信部正规资质
腾讯云新用户大礼包代金券高价收cpa注册量高价展示【腾讯云】2核2G/9.93起租服务器找45互联 随时退换阿里云 短信服务 验证秒达

[网络资源] 求PHP判断字符串是否是拼音的代码 [复制链接]
查看:2283 | 回复:6

6

主题

6741

帖子

2566

积分

落伍者(两全齐美)

管理员

Rank: 2

贡献
4
鲜花
0
注册时间
2005-2-28
发表于 2013-8-27 11:17:16 | 显示全部楼层 |阅读模式 来自 中国浙江杭州
3000积分
找了N久,就没一个好用的,找万能的落伍。
字符串例如:
pin  是
yin  是
piny 不是
pinyin 是

求代码

最佳答案

查看完整内容

原先弄过一个,先占位,我去找找看。
回复

使用道具 举报

134

主题

2673

帖子

6339

积分

落伍者(三羊开泰)

大中华区总裁

Rank: 3Rank: 3

贡献
10
鲜花
2
注册时间
2005-7-21

QQ绑定落伍手机绑定

发表于 2013-8-27 11:17:17 | 显示全部楼层 来自 中国浙江杭州
本帖最后由 eNom 于 2013-8-27 12:27 编辑

原先弄过一个,先占位,我去找找看。
  1. <?
  2. $$$$a = "pinyin";
  3. $$$$arr =array("a","ai","an","ang","ao","ba","bai","ban","bang","bao","bei","ben","beng","bi","bian","biao","bie","bin","bing","bo","bu","ca","cai","can","cang","cao","ce","ceng","cha","chai","chan","chang","cao","che","chen","cheng","chi","chong","chou","chu","chuai","chuan","chuang","chui","chun","chuo","ci","cong","cou","cu","chuan","cui","cun","cuo","da","dai","dan","dang","dao","de","deng","di","dian","diao","die","ding","dui","dong","dou","du","duan","dui","dun","duo","e","en","er","fa","fan","fang","fei","fen","feng","fo","fou","fu","ga","gai","gan","gang","gao","ge","gei","gen","geng","gong","gou","gu","gua","guai","guan","guang","gui","gun","guo","ha","hai","han","hang","hao","he","hei","hen","heng","hong","hou","hu","hua","huai","huan","huang","hui","hun","huo","ji","jia","jian","jiang","jiao","jie","jin","jing","jiong","jiu","ju","juan","jue","jun",
  4. "ka","kai","kan","kang","kao","ke","kei","ken","keng","kong","kou","ku","kua","kuai","kuan","kuang","kui","kun","kuo","la","lai","lan","lang","lao","le","lei","leng","li","lia","lian","liang","liao","lie","lin","ling","liu","long","lou","lu","lv","luan","lue","lun","luo","ma","mai","man","mang","mao","me","mei","men","meng","mi","mian","miao","mie","min","ming","miu","mo","mou","mu","na","nai","nan","nang","nao","ne","nei","nen","neng","ni","nian","niang","niao","nie","nin","ning","niu","nong","nu","nv","nuan","nue","nuo","ou","pa","pai","pan","pang","pao","pei","pen","peng","pi","pian","piao","pie","pin","ping","po","pou","pu","qi","qia","qian","qiang","qiao","qie","qin","qing","qiong","qiu","qu","quan","que","qun","ran","rang","rao","re","ren","reng","ri","rong","rou","ru","ruan","rui","run","ruo","sa","sai","san","sang","sao","se","sen","seng","sha","shai","shan","shang","shao","she","shen","sheng","shi","shou","shu","shua","shuai","shuan","shuang","shui","shun","shuo","si","song","sou","su","suan","sui","sun","suo","ta","tai","tan","tang","tao","te","teng","ti","tian","tiao","tie","ting","tong","tou","tu","tuan","tui","tun","tuo","wa","wai","wan","wang","wei","wen","weng","wo","wu","xi","xia","xian","xiang","xiao","xie","xin","xing","xiong","xiu","xu","xuan","xue","xun","ya","yan","yong","yao","ye","yi","yin","ying","yo","yong","you","yu","yuan","yue","yun","za","zai","zan","zang","zao","ze","zei","zen","zeng","zha","zhai","zhan","zhong","zhao","zhe","zhen","zheng","zhi","zhong","zhou","zhu","zhua","zhuai","zhuan","zhuang","zhui","zhun","zhuo","zi","zong","zou","zu","zuan","zui","zun","zuo");


  5. function isRight($$$$arr, $$$$word) {
  6.     if(in_array($$$$word, $$$$arr)) {
  7.         return true;
  8.     }
  9.     for($$$$i=1;$$$$i<strlen($$$$word);$$$$i++) {
  10.         if(isRight($$$$arr, substr($$$$word, 0, $$$$i)) && isRight($$$$arr, substr($$$$word, $$$$i))) {  
  11.             return true;
  12.         }        
  13.     }
  14.     return false;
  15. }

  16. if(isRight($$$$arr, $$$$a)) {echo $$$$a;}
  17. ?>
复制代码
回复

使用道具 举报

688

主题

2万

帖子

5万

积分

落伍者(五谷丰登)

Rank: 8Rank: 8

贡献
6353
鲜花
53
注册时间
2011-12-29

QQ绑定落伍者落伍手机绑定

发表于 2013-8-27 11:18:08 | 显示全部楼层 来自 中国广东东莞
不懂这个
回复

使用道具 举报

头像被屏蔽

117

主题

941

帖子

3752

积分

落伍者(两全齐美)

Rank: 2

贡献
320
鲜花
2
注册时间
2005-12-1

QQ绑定落伍者落伍手机绑定

发表于 2013-8-27 11:23:03 | 显示全部楼层 来自 中国北京
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复

使用道具 举报

头像被屏蔽

103

主题

3万

帖子

3万

积分

落伍者(四季发财)

Rank: 4

贡献
461
鲜花
5
注册时间
2005-11-10
发表于 2013-8-27 11:27:28 | 显示全部楼层 来自 中国福建厦门
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复

使用道具 举报

486

主题

2万

帖子

9797

积分

落伍者(三羊开泰)

Rank: 3Rank: 3

贡献
684
鲜花
47
注册时间
2011-11-23

落伍者落伍手机绑定

发表于 2013-8-27 11:28:07 | 显示全部楼层 来自 中国四川眉山
不懂 路过
回复

使用道具 举报

头像被屏蔽

231

主题

2万

帖子

2万

积分

落伍者(四季发财)

Rank: 4

贡献
559
鲜花
11
注册时间
2005-11-19
发表于 2013-8-27 11:42:30 | 显示全部楼层 来自 中国福建厦门
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

论坛客服/商务合作/投诉举报:2171544 (QQ)
落伍者创建于2001/03/14,本站内容均为会员发表,并不代表落伍立场!
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论!
落伍官方微信:2030286 邮箱:(djfsys@gmail.com|tech@im286.com)
© 2001-2014

浙公网安备 33060302000191号

浙ICP备11034705号 BBS专项电子公告通信管[2010]226号

  落伍法律顾问: ITlaw-庄毅雄

手机版|找回帐号|不能发帖?|Archiver|落伍者

GMT+8, 2024-11-19 08:20 , Processed in 0.079404 second(s), 34 queries , Gzip On.

返回顶部