Strings for newbies to PHP
1. String variable
String variable is used to store and process text
Create a string named a variable and assign the value to "Hello world!". Then we output the value of a variable
The concatenation operator in the string
There is only one concatenation operator in the string " . " Is this right? Two strings are linked together
strlen() function
Sometimes it is useful to know the length of the string value
Note: The number ofcharacters is only 12, but there are 2 spaces. Spaces are also characters. The output result is 14
strpos() function
strpos() function is used to find a character or a specified piece of text in a string
Note: The subscript of the string starts with 0, that is, the position of h in the above code is 0, Then the position of l is in the fifth position, so the output is 5 instead of 6
There are many functions that operate on strings in php, as shown in the figure below
For specific usage, please refer to the manual or Baidu