Home > Article > Backend Development > The use of strings in PHP programs
1. String declaration
(1) You can use single quotes and double quotes
Difference: Variables can be parsed in double quotes, and all escape characters can be used
(2) Use the delimiter << <
2. String processing
mainly uses strings for splitting, matching, searching, and replacing
3. String processing functions
Features:
1. If it is other types of data, also You can use the string processing function to process it. The processing process is to automatically convert other types of data into strings before processing.
Second, strings can be accessed through subscripts like arrays, but the type is not an array, but a string
Three, in addition to English, there are also Chinese strings (different encodings account for The number of bytes is different, UTF8 occupies 3 bytes)
(1) strlen("hello"); count the length of the string
(2) $str[0].$str[1]; access string $ The first and second elements of str are of type string. (You can also use {} to access subscripts)
The above introduces the use of strings in PHP programs, including aspects of content. I hope it will be helpful to friends who are interested in PHP tutorials.