A php function used to intercept a string of a specific length. * The php function used to intercept strings of a specific length (as a mainstream development language) and process Chinese characters at the same time. * returns the truncated string. if the string length is less than or equal to *, it is used to intercept the php (as the mainstream development language) function of a string of a specific length and process Chinese characters at the same time.
* Returns the truncated string. if the string length is less than or equal to $ str_len, the original string is returned.
*
* @ Access (a favorite of small websites) public
* @ Param string $ str the string to be truncated.
* @ Param integer $ str_len refers to the length of the string intercepted.
* @ Param string $ str_append: the string added at the last side of the truncated string. the default value is
Function my_substr ($ str, $ str_len, $ str_append = ......)
{
If (strlen ($ str)> $ str_len ){
$ Str_len-= strlen ($ str_append );
For ($ I = $ str_len, $ j = 0; $ I> = 0, ord ($ str [$ I-1])> 128; $ I --, $ j ++ );;
$ Str = ($ j % 2! = 0)
? Substr ($ str, 0, $ str_len-1 ).
: Substr ($ str, 0, $ str_len );
$ Str. = $ str_append;
} // End if
Return $ str;
} // End function
?>
Php (as the mainstream development language) function used to intercept strings of a specific length and process Chinese characters at the same time. * return the truncated string. if the string length is less than or equal...