初学php时就知道利用替换函数来替换指定的数字,但要替换指定位置我们需要简单处理一下才行,下面我介绍几个例子把指定位星号显示出来。
例子,用户名
代码如下 | 复制代码 |
function cut_str($string, $sublen, $start = 0, $code = 'UTF-8') if(count($t_string[0]) - $start > $sublen) return join('', array_slice($t_string[0], $start, $sublen)); for($i=0; $i
{ |
示例
代码如下 | 复制代码 |
$str = "如来神掌"; |
下面附两个IP地址与手机号星号显示
初学PHP,看到别人是通过合并和拆分数组进行这个操作!所以转过来!!
代码如下 | 复制代码 |
$ip =$_SERVER['REMOTE_ADDR']; $ip_arr= explode('.', $ip); $ip_arr[3]='*'; $ip= implode('.', $ip_arr); echo $ip; ?> |
手机号的
代码如下 | 复制代码 |
$haoma="15012345678"; |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Chinese version
Chinese version, very easy to use

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.
