几个好用的截取字符串的php函数分享_PHP教程

原创
2016-07-20 11:14:39 621浏览

分享几个好用的PHP 截取字符串函数(支持gb2312和utf-8)。


 mysubstr(, ,  = "" =  + ( = 0;  ; ++(((, , 1)) > 0xa0 .= (, , 2++ 
 .= (, , 1 ?>


 utf8Substr(, ,  ('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'..'}'. 
'((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'..'}).*#s', 
'$1',?>



 cut_str(, ,  = 0,  = 'UTF-8'( == 'UTF-8' = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]|[\xe1-\xef][\x80-\xbf][\x80-\xbf]|\xf0[\x90-\xbf][\x80-\xbf][\x80-\xbf]|[\xf1-\xf7][\x80-\xbf][\x80-\xbf][\x80-\xbf]/"(, , (([0]) -  > )  ('', ([0], , ))."..." ('', ([0], ,  = *2 = *2 = ( = ''(=0; ; ++(>= && +(((, , 1))>129.= (, , 2.= (, , 1(((, , 1))>129) ++(() ) .= "..."  = "abcd需要截取的字符串" cut_str(, 8, 0, 'gb2312'?>

 
* @param string $String the string to cut. 
* @param int $Length the length of returned string. 
* @param booble $Append whether append "...": false|true 
* @return string the cutted string. 
* @by www.jbxue.com
 
 sysSubStr(,, =  (()   = 0 (  = (,,1 ( () >=224 = (,,3 =  + 3( () >=192 = (,,2 =  + 2 =  + 1[] =  = ("",( .= "..."  = "book.chinaz.com -- 站长书库、站长教程" = "18" =  sysSubStr(,,?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/440270.htmlTechArticle分享几个好用的PHP 截取字符串函数(支持gb2312和utf-8)。 ? mysubstr( , , = "" = + ( = 0; ; ++ ( ( ( , , 1)) 0xa0 .= ( , , 2 ++ .= ( , , 1 ? ? utf8Substr( , , ('#^(?:...
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。