<? PHP $mobile = "15810320826"echosubstr_replace($mobile, ' * * * ', 3, 4 ?>
Substr_replace
(PHP 4, PHP 5)
substr_replace- a substring of a replacement string
Descriptionmixed substr_replace ( mixed
$string , mixed
$replacement , mixed
$start [, mixed
$length ])
Substr_replace () is substituted in a copy of the string by using a substring that is qualified with the string start optional length parameter replacement .
Parameters
-
-
string
-
-
The input string.
An array of strings can is provided, in which case the replacements would occur on each string in turn. In this case, replacement the, start and length parameters may provided either as scalar values to is applied to each input str ing in turn, or as arrays, in which case the corresponding array element would be a used for each input string.
-
-
replacement
-
-
The replacement string.
-
-
start
-
-
If start positive, the replacement will string start at the start position.
If start it is negative, the substitution string starts at the penultimate start position.
-
-
length
-
-
If this parameter is set and is positive, the string length of the substring being replaced is indicated. If set to negative, it represents the number of characters at the end of the substring to be replaced string . If this parameter is not provided, it defaults to Strlen ( string ) (the length of the string). Of course, if it length is 0, then the function is where it will be replacement inserted string start .
return value
Returns the result string. If string It is a group, an array will also be returned.
Substr_replace () Function: Hide the middle 4 digits of the phone number as the * number