How to replace the characters in fixed positions in PHP?

后端 未结 7 1693
清歌不尽
清歌不尽 2020-12-11 07:43

I want to replace with the 4~8 characters of a string with *,how to do it?

HelloWorld

=>

Hell****ld
相关标签:
7条回答
  • 2020-12-11 08:47
    $var="HelloWorld";
    $result=substr_replace($var, '****', 4,4 ) . "<br />\n";
    
    0 讨论(0)
提交回复
热议问题