I want to replace with the 4~8 characters of a string with *,how to do it?
4~8
*
HelloWorld => Hell****ld
You'll need to use substr_replace().
$str = substr_replace("HelloWorld","****",3,-2);