Home  >  Article  >  Backend Development  >  求一函数,除尾部最后一个字

求一函数,除尾部最后一个字

WBOY
WBOYOriginal
2016-06-23 13:29:251047browse

字符如下;
$str="震中品类城辚咪。";
$str = "大约在冬季!";


不要最末的标点符号,如何实现?是汉字。


回复讨论(解决方案)

iconv_set_encoding("internal_encoding", "GBK"); //根据你的字符集修改echo iconv_substr("震中品类城辚咪。", 0, -1), PHP_EOL;echo iconv_substr("大约在冬季!", 0, -1), PHP_EOL;
震中品类城辚咪
大约在冬季

[code=php]iconv_set_encoding("internal_encoding", "GBK"); //根据你的字符集修改
大约在冬季



谢谢大哥。
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
Previous article:php中的$_SERVER从哪来Next article:Laravel 是个好框架