substr_replace is a bit like str_replace in that it directly replaces part of the string. Let me introduce it to you. How to do it.
The substr_replace() function replaces part of a string with another string.
Usage
substr_replace(string,replacement,start,length)
Note that when the string contains Chinese characters, garbled characters will appear without special processing.
The code is as follows | Copy code | ||||||||||||||||||||||||
echo substr_replace($string1,'###',0); //###
//12345### echo substr_replace($string1,'###',-6,-1); //123###9echo "n"; echo substr_replace($string1,'###',-1);//123###9 echo "n";
Program execution result: abcdefghijk...456789z.jpg Program List: Replace extra characters with ellipsis
http: //www.bkjia.com/PHPjc/632654.html TechArticle substr_replace is a bit like str_replace, which is to directly replace part of the string. Here is what I will tell you: Introduce the operation method. The substr_replace() function replaces a string...
Previous article:PHP parent class calls subclass method instance_PHP tutorial
Next article:PHP object-oriented development study notes_PHP tutorial
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Latest Issues
Group MySQL results by ID for looping over
I have a table with flight data in mysql. I'm writing a php code that will group and displ...
From 2024-04-06 17:27:56
0
1
406
Related Topics
More>
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
|