Mb_strimwidth (PHP4 & gt; = 4.0.6, PHP5) mb_strimwidth & mdash; returns the stringmb_strimwidth (string $ str, int $ start, int $ width [, string $ trimmarker [
Mb_strimwidth
(PHP 4> = 4.0.6, PHP 5)
Mb_strimwidth-get the string truncated by the specified width
Description
String mb_strimwidth (string $ str, int $ start, int $ width [, string $ trimmarker [, string $ encoding])
Truncate the str string by pressing width.
Parameters
Str
The string to be truncated.
Start
The start offset. A string starting from the number of characters. (0 characters by default)
Width
The width of the trim.
Trimmarker
When the string is truncated, add it to the end of the string after the string is truncated.
Encoding
The encoding parameter is character encoding. If omitted, internal character encoding is used.
Return value
The truncated string. If trimmarker is set, the trimmarker is appended to the returned value.
Example
Example #1 mb_strimwidth () Example
Echo mb_strimwidth ("Hello World", 0, 10 ,"...");
// Output Hello W...
?>
Solve the garbled characters in WordPress using the mb_strimwidth function!
1. Enable the mb_string extension service of the apache server.
2. string mb_strimwidth (string $ str, int $ start, int $ width [, string $ trimmarker [, string $ encoding])
Use the encoding parameter to set the character encoding.
Example:
Echo mb_strimwidth ("io100-Knowledge Base", 0, 10, "...", [backcolor = transparent] "UTF-8 ");
?>
Reprinted please indicate the source: http://www.ios100.net/open/wordpress/49.html