Home > Article > Backend Development > PHP string replacement function substr_replace() usage example_PHP tutorial
This article mainly introduces the usage of php string replacement function substr_replace(), and analyzes the use of substr_replace function in php with examples. The skills have certain reference value. Friends who need them can refer to them
The example in this article describes the usage of php string replacement function substr_replace(). Share it with everyone for your reference. The specific analysis is as follows:
substr_replace is used to replace the substring at the specified position in the specified string
?
3 4
5
6
|
$string = "Warning: System will shutdown in NN minutes!"; $pos = strpos($string, "NN");
|
1 2 3 | Warning: System will shutdown in 15 minutes! (10 minutes later) Warning: System will shutdown in 5 minutes! |