Home > Backend Development > PHP Tutorial > 『PHP』Introduction to the use of PHP truncation function mb_substr()_PHP tutorial

『PHP』Introduction to the use of PHP truncation function mb_substr()_PHP tutorial

WBOY
Release: 2016-07-21 15:11:47
Original
680 people have browsed it

Function: mb_substr( $str, $start, $length, $encoding )

$str, the string that needs to be truncated
$start, the starting point of truncation
$length, the length (note, this Different from mb_strimwidth, 1 represents a Chinese character)
$encoding, encoding, I set it to utf-8

Example: Truncate the article title and control it to 15 characters

Copy code The code is as follows:


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/326820.htmlTechArticleFunction: mb_substr( $str, $start, $length, $encoding ) $str, the string that needs to be truncated $start, truncation start point $length, length (note, this is different from mb_strimwidth, 1 represents one...
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