In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to replace the specified bit string by php. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
In php, you can use the substr_replace () function to replace the character specified in the string, with the syntax "substr_replace (string, replacement value, $start,1)"; where the parameter "$start" specifies the position where the replacement begins, which can be a negative value.
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
Php replaces the specified bit string
In php, you can use the substr_replace () function to replace the character at the specified position in the string.
Description:
The substr_replace () function replaces part of a string with another string.
Syntax:
The substr_replace ($string,$replacement,$start,$length) parameter describes that string is required. Specifies the string to check. Replacement is required. Specifies the string to insert. Start is required. Specifies where to start the replacement of the string.
Positive number-starts at the specified position of the string
Negative number-starts at the specified position at the end of the string
0-starts at the first character in the string
Length is optional. Specifies how many characters to replace. The default is the same length as the string.
Positive number-the length of the string being replaced
Negative number-the number of characters replaced from the end of the string
0-insert instead of replace
Substr_replace () replaces the substrings qualified by the start and optional length parameters with replacement in the copy of the string string.
If start is positive, the replacement starts at the start position of the string. If the start is negative, the replacement starts at the penultimate start of the string.
If the length parameter is set and is a positive number, it indicates the length of the substring to be replaced in the string. If set to a negative number, it indicates the number of characters at the end of the substring to be replaced from the end of the string. If this parameter is not provided, it defaults to strlen (string) (the length of the string). Of course, if length is 0, then the function of this function is to insert replacement into the start location of the string.
This is the end of the article on "how to replace the specified string by php". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.