PHP string substitution function substr_replace () Usage instance
This article mainly introduces the PHP string substitution function substr_replace () usage, the example analyzes the PHP Substr_replace function's use skill, has the certain reference value, needs the friend to refer to under
This example describes the PHP string substitution function substr_replace () usage. Share to everyone for your reference. The specific analysis is as follows:
Substr_replace used to replace a substring of a specified position in a specified string
?
1 2 3 4 5 6 7 |
$string = "Warning:system'll shutdown in NN minutes!"; $pos = Strpos ($string, "NN"); Print ($string, "Substr_replace", $pos, 2). " \ n "); Sleep (10*60); Print (Substr_replace ($string, "5", $pos, 2). " \ n "); ?> |
The above code enters the following result
?
1 2 3 |
Warning:system'll shutdown in minutes! (Ten minutes later) Warning:system'll shutdown in 5 minutes! |
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/969352.html www.bkjia.com true http://www.bkjia.com/PHPjc/969352.html techarticle php string substitution function substr_replace () Usage example this article mainly introduces the PHP string substitution function substr_replace () usage, the example analysis of PHP substr_replace function of the use of skills ...