In practical programming, we usually use the STRTR () function when we want to implement the function of string substitution. Let's take a look at how the PHP string substitution is implemented.
V First look at the two states of this PHP string
What we're going to talk to you about today is aboutLet's take a look at this php string substitution function php string substitution function strtr () two states
STRTR (String,from,to)
or STRTR (String,array)
First for PHP string substitution
This article is to introduce PHP common string regular substitution and split function comparison, in PHP string regular replacement is probably: Str_replace, Str_ireplace, Substr_replace, Preg_replace, Preg_match, Preg_match_all, Preg_quote,
STRTR (string,from,to):
Replace one character at a distance, whichever is shorter in the From and to, for example:STRTR ("Aidenliu", "AI", "B") replaces only the a output that appears in the original string: BidenliuSTRTR ("Aidenliu", "a", "BC")
This article mainly describes the PHP preg_replace () regular replacement of all strings matching the method, has a certain reference value, now share to everyone, the need for friends can refer to
PHP preg_replace () Regular substitution, unlike
What is the implementation of the PHP regular expression substitution? First introduce you to the PHP preg_replace,php Preg_replace use is our implementation of the method, then for the PHP regular expression substitution implementation process we
In PHP, there are several character substitution functions, such as: Str_replace, Substr_replace, Preg_replace, Preg_split, Str_split and other functions, let me give you a summary of the introduction.
Yi, Str_replace
In PHP, there are several character substitution functions, such as: Str_replace, Substr_replace, Preg_replace, Preg_split, Str_split and other functions, let me give you a summary of the introduction.Yi, Str_replace
This article illustrates the substitution, segmentation, and connection methods of PHP strings. Share to everyone for your reference, specific as follows:
Substitution of strings
1. Perform search and replace of a regular expression
Copy
Let's take a look at this php string substitution function php string substitution function strtr () two statesSTRTR (string, from, to) or Strtr (string,array)First for PHP string substitution function strtr () First WayLet's take a look at the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.