Home  >  Article  >  Backend Development  >  分割字符的有关问题

分割字符的有关问题

WBOY
WBOYOriginal
2016-06-13 10:48:39606browse

分割字符的问题?
想将字符串分为两部分,第一个字为第一部分,剩余为第二部分。

例如,英国旅游,分割成 英+国旅游
中国北京,分割成 中+国北京

求个简便方法

------解决方案--------------------
iconv_set_encoding("internal_encoding", "GBK");//是什么编码就填什么编码

$s = '英国旅游';
echo iconv_substr($s, 0, 1) . '+' . iconv_substr($s, 1);

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn