Home  >  Article  >  Backend Development  >  PHP letter case conversion function_PHP tutorial

PHP letter case conversion function_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:12:53806browse

Share a common function for converting letters to uppercase and lowercase in PHP programming.

1. Convert the string to lowercase
strtolower(): This function converts all the characters of the incoming string parameter into lowercase and puts the string back in decimal form

2. Convert characters to uppercase
strtoupper(): The function of this function is opposite to the strtolower function. It converts all the characters of the passed character parameter into uppercase and returns the string in uppercase. The usage is the same as strtolowe().

3. Convert the first character of the string to uppercase
ucfirst(): 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 () is the same.

4. Convert the first character of each word in the string to uppercase
ucwords(): This function changes the first character of each word in the passed string to uppercase. For example, "hello world", after being processed by this function, will return "Hello Word". The usage is the same as strtolowe().

The above are the string uppercase conversion functions commonly used in PHP. For specific use cases, please refer to : This article summarizes examples of letter case conversion in php.

If you have problems during use, you can refer to the article: Summary of PHP case-sensitive issues to find the correct solution.

Hereby share it to help friends who are destined to do so.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/440402.htmlTechArticle Share a common function for converting letters to uppercase and lowercase in PHP programming. 1. Convert the string to lowercase strtolower(): This function converts all characters in the passed string parameter...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn