当前位置:网站首页>Hide Chinese name
Hide Chinese name
2022-07-05 13:43:00 【Php_ XiaoZhi】
/**
* Only the first and last characters of the string are reserved , Hide intermediate use * Instead of ( Only the first one is displayed when there are two characters )
* @param string $user_name full name
* @return string Formatted name
*/
function substr_cut($user_name){
$strlen = mb_strlen($user_name, 'utf-8');
$firstStr = mb_substr($user_name, 0, 1, 'utf-8');
$lastStr = mb_substr($user_name, -1, 1, 'utf-8');
return $strlen == 2 ? $firstStr . str_repeat('*', mb_strlen($user_name, 'utf-8') - 1) : $firstStr . str_repeat("*", $strlen - 2) . $lastStr;
}边栏推荐
- [深度学习论文笔记]使用多模态MR成像分割脑肿瘤的HNF-Netv2
- Summit review | baowanda - an integrated data security protection system driven by compliance and security
- Summary and arrangement of JPA specifications
- 不知道这4种缓存模式,敢说懂缓存吗?
- 山东大学暑期实训一20220620
- Jasypt configuration file encryption | quick start | actual combat
- [notes of in-depth study paper]transbtsv2: wider instead of deep transformer for medical image segmentation
- MySQL - database query - sort query, paging query
- 私有地址有那些
- What happened to the communication industry in the first half of this year?
猜你喜欢

Kotlin协程利用CoroutineContext实现网络请求失败后重试逻辑

Backup and restore of Android local SQLite database

Interviewer soul torture: why does the code specification require SQL statements not to have too many joins?

Jenkins installation

Self built shooting range 2022

Solve the problem of invalid uni app configuration page and tabbar

Jasypt configuration file encryption | quick start | actual combat

Binder communication process and servicemanager creation process
![[public class preview]: basis and practice of video quality evaluation](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[public class preview]: basis and practice of video quality evaluation

A detailed explanation of ASCII code, Unicode and UTF-8
随机推荐
MATLAB论文图表标准格式输出(干货)
Shandong University Summer Training - 20220620
JS to determine whether an element exists in the array (four methods)
redis6数据类型及操作总结
Basic characteristics and isolation level of transactions
Apicloud studio3 WiFi real machine synchronization and WiFi real machine preview instructions
Intranet penetration tool NetApp
leetcode 10. Regular expression matching regular expression matching (difficult)
4年工作经验,多线程间的5种通信方式都说不出来,你敢信?
With 4 years of working experience, you can't tell five ways of communication between multithreads. Dare you believe it?
leetcode 10. Regular expression matching regular expression matching (difficult)
Nantong online communication group
嵌入式软件架构设计-消息交互
"Baidu Cup" CTF competition in September, web:sql
Programmer growth Chapter 8: do a good job of testing
Laravel framework operation error: no application encryption key has been specified
What happened to the communication industry in the first half of this year?
[server data recovery] a case of RAID5 data recovery stored in a brand of server
【Hot100】33. Search rotation sort array
go map