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

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

WBOY
Release: 2016-06-23 13:29:25
Original
1079 people have browsed it

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


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


回复讨论(解决方案)

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

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



谢谢大哥。
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template