标签:style blog color io ar for div art sp
header(‘Content-type:text/html;charset=utf-8‘); function cutstr($str) { #计算$str的字符个数 preg_match_all("/./u", $str, $len); $strlen = (int) count($len[0]); #计算中间位置开始转* $start = ceil($strlen / 2); $start = ceil($start / 2); #计算结束的字符长度 $forlen = $strlen - $start; $string = ‘‘; #将字符串里面的字分割成一个数组 for($i=0; $i < $strlen; $i ++) { if( $i <= $start || $i >= $forlen ) { $string .= $len[0][$i]; } else { $string .= ‘*‘; } } return $string; }
$str = ‘542928955@qq.com‘;
echo cutstr( $str ); exit;
标签:style blog color io ar for div art sp
原文地址:http://www.cnblogs.com/freezingrain/p/3978892.html