初学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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

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

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1
Powerful PHP integrated development environment