Home > Backend Development > PHP Tutorial > php截取中文字符串取后四位

php截取中文字符串取后四位

WBOY
Release: 2016-06-23 14:12:13
Original
1000 people have browsed it

$str = "需要截取的字符串";

只留下“的字符串”!!!
  
取该字符串的后四位 怎么取


回复讨论(解决方案)

$str = "需要截取的字符串";iconv_set_encoding("internal_encoding", "gbk");echo iconv_substr($str, -4);
Copy after login
如果是 utf-8 的就
iconv_set_encoding("internal_encoding", "utf-8");

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