php mb_substr函数截取中文字符有关问题

WBOY
Release: 2016-06-13 11:26:56
Original
939 people have browsed it

php mb_substr函数截取中文字符问题
使用php mb_substr函数截取一个变量的前2个与后2个字符,变量内容是中文字符,但只能输出前2个字符,无法输出后2个字符,是不是mb_substr函数不支持从尾部截取?还请高手指点。
$ip="广东省佛山市 电信 ";
echo mb_substr($ip,0,2,'utf-8');
echo mb_substr($ip,-2,'utf-8');
?>

当前输出结果:广东
希望输出结果:广东电信


谢谢!

Related labels:
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