PHP格式化手机号码、银行卡号,中间用星号显示
/** * 银行卡、手机号格式化,中间用*号显示 * @param unknown $type * @param unknown $number * @return mixed|unknown */ function FormatCardView($type,$number){ switch ($type){ case "phone": $resstr=substr_replace($number,'****',3,4); return $resstr; break; case "bankcard": $split = str_split($number,4); $split = array_fill(1,count($split) - 2,"****") + $split; ksort($split); return implode(" ",$split); } }
共 0 条评论