php字符串替换函数
2013-11-26 20:43
483 查看
/*** @param str 字符串* @param start 开始的数* @param leftintheend 后面的数* @author an* */public function replaceInnerLetter($str,$start=3,$leftintheend=0,$repalce="*",$middleleght=6){$length = mb_strlen($str,"utf-8");$alllength = ($start+$leftintheend);if($length <= $alllength){return $str;}else{$repeadleght = $length-$alllength;if($repeadleght > $middleleght){$repeadleght = $middleleght;}return mb_substr($str,0,$start,"utf-8").str_repeat($repalce,$repeadleght).mb_substr($str,$length-$leftintheend,$leftintheend,"utf-8");}}
相关文章推荐
- PHP 字符串替换 substr_replace 与 str_replace 函数
- php字符串与字符替换函数
- php中几个字符串替换函数
- PHP字符串正则替换函数preg_replace
- PHP 字符串替换 substr_replace 与 str_replace 函数
- PHP字符串替换函数strtr()的功能实现讲解
- PHP 字符串正则替换函数preg_replace使用说明
- PHP字符串替换str_replace()函数4种用法详解
- php中几个字符串替换函数详解
- php字符串替换函数substr_replace()用法实例
- PHP字符串替换str_replace()函数4种用法详解
- php中的字符串常用函数 str_replace 字符串替换,替换全角空格
- php中几个字符串替换函数详解
- php字符串替换的几个函数
- php函数之子字符串替换 str_replace
- php中的字符串常用函数(三) str_replace() 子字符串替换
- php字符串与字符替换函数
- php中几个字符串替换函数详解