标签: php
我有一个仅包含数字的16位文本。我有一个PHP变量,例如:$ example ['example'] 我希望此变量仅显示前6位和后4位,其他变量将被替换为星号。
已解决,并带有https://i.stack.imgur.com/C5ZPF.png
答案 0 :(得分:0)
使用str_replace函数使操作变得简单
$example="1234567890123456"; $replace=str_replace(substr($example,6,6),str_repeat('*',6),$example); echo "$replace";