This example describes a simple way to intercept a string in PHP. Share to everyone for your reference, specific as follows:
Intercepting digest public
static function Mbsubstr ($STR) {
$strleng = Mb_strlen ($str, "UTF8");
$mbstr = Mb_substr ($str, 0,140, ' UTF8 ');
$strdstr = Mb_substr ($str, 140, $strleng, ' UTF8 ');
$strlengs = Mb_strlen ($strdstr, ' utf8 ');
$STRC = "";
For ($i =0 $i < $strlengs; $i + +) {
$strn = Mb_substr ($strdstr, $i, 1, ' UTF8 ');
if ($strn = = ". " || $strn = = "? " || $STRN = = "! ") {break
;
}
$strc. = $strn;
}
$STRD = $mbstr. $strc;
echo $strleng. " @ ". Mb_strlen ($STRD, ' UTF8 ')." @ ". $strd." <br> ";
return $STRD;
}
More interested in PHP related content readers can view the site topics: "PHP string (String) Usage summary", "PHP Array" Operation Techniques Encyclopedia, "PHP Basic Grammar Primer", "PHP Operations and Operator Usage Summary", " Introduction to PHP object-oriented programming program, "PHP Network Programming Skills Summary", "Php+mysql Database Operation Introduction" and "PHP common database Operation Skills Summary"
I hope this article will help you with the PHP program design.