PHP string substitution function substr_replace () Usage instance, Substrreplace
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
<?php$string = "Warning:system would shutdown in NN minutes!"; $pos = Strpos ($string, "NN");p rint ($string, "Substr_replace", $pos, 2). " \ n "), Sleep (10*60);p rint (Substr_replace ($string," 5 ", $pos, 2)." \ n ");? >
The above code enters the following result
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/969503.html www.bkjia.com true http://www.bkjia.com/PHPjc/969503.html techarticle php string substitution function substr_replace () Usage instance, Substrreplace This example describes the PHP string substitution function substr_replace () usage. Share to everyone for your reference. Specific analysis ...