PHP完全自学手册(珍藏版) 中文pdf扫描版下载
- function sub_right($string, $strlen = '50'){
- $tmpstr = "";
- $lengs =strlen($string)-3;
- if($lengs<=10)$strlen=$lengs-4;
- //$tmpstr .= substr($string, 0, $strlen);
- //print_r($lengs);
- for($i = 0; $i < strlen($string); $i++) {
- if($i<$strlen){
- if(ord(substr($string, $i, 1)) > 0xa0) {
- $tmpstr .= substr($string, $i, 2);
- $i++;
- } else
- $tmpstr .= substr($string, $i, 1);
- }else{
- if($i < $lengs){
- $tmpstr .="*";
- }
- }
- }
- $tmpstr .= substr($string,-3);
- return $tmpstr;
- }
- $str="13029942739";
- echo sub_right($str,3);
转载请注明:谷谷点程序 » php隐藏手机号码中间几位数