十一、隐藏姓名

?php
str = '宋萨呀';

head   = mb_substr($str,0,1,'utf-8');
foot   = mb_substr($str,-1,1,'utf-8');
length = mb_strlen($str,'utf-8')-2;
star_length = str_repeat('*',$length);
cho $res = $head .$star_length.$foot;

你可能感兴趣的:(十一、隐藏姓名)