2 , string concatenation example:
3. String interception substr(), mb_substr example:
But when you intercept a Chinese string, it is easy to have garbled characters, because a Chinese character is Two bytes, while one English letter is one byte. Solution: 2. mb_substr(), the usage method is the same as substr, but you need to enable the extension=php_mbstring.dll extension in php.ini. Example:
3. characters String search strpos() Definition and usage The strpos() function returns the position of the first occurrence of a string within another string. If the string is not found, false is returned. Grammar strpos(string,find,start) Parameter Description string required specifies the string to be searched for find Required Specifies the character to be found. start is optional. Specifies where to start the search Example:
4, string replacement str_replace example:
Specify the position to replace substr_replace
5, string to uppercase and lowercase function Convert string to lowercase strtolower(): This function converts all characters in the passed string parameter to lowercase and puts them back into the string in decimal form. example:
Output results : i love YOU Convert characters to uppercase strtoupper(): The function of this function is opposite to the strtolower function. It converts all the characters of the incoming character parameter into uppercase and returns the string in uppercase. The usage is the same as strtolowe(). Convert the first character of the string to uppercase usfilst(): The function of this function is to change the first character of the string to uppercase. This function returns the string with the first character uppercase. The usage is the same as strtolowe(). Convert the first character of each word in the string to uppercase ucwords(): This function capitalizes the first character of each word in the passed string. For example, "hello world" will return "Hello Word" after being processed by this function. The usage is the same as strtolowe(). >> View more php introductory tutorials |