Home > Backend Development > PHP Tutorial > Usage of php Chinese interception string mb_substr

Usage of php Chinese interception string mb_substr

WBOY
Release: 2016-07-25 08:58:28
Original
962 people have browsed it
This article introduces an example of using the mb_substr function to intercept Chinese strings in PHP for your reference.

Use function mb_substr, example:

<?php
/**
* mb_substr截取中文字符串
* edit bbs.it-home.org
*/
header('Content-Type:text/html;charset:utf-8');  
$a = "脚本sdf学堂,欢迎sf3s大家的xfs光临。好幸fxesd福啊。";  
$b = mb_substr($a, 0,10,'utf-8');  
echo $b; 
?>
Copy after login

For examples of the mb_substr function in php, you can also refer to: php truncate string function mb_substr() example Two functions for php to intercept Chinese strings (iconv_substr and mb_substr) php Chinese string interception (mb_substr) example



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