php method to convert characters to lowercase: first create a PHP sample file; then define a string; finally convert the string to lowercase through the "strtolower($string);" method.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
php converts all strings into uppercase Or the lowercase method
In php, you can use the strtolower and strtoupper functions to convert all English characters in the string into lowercase or uppercase
<?php $string = "Learn PHP string functions at jb51.net"; $lower = strtolower($string); $upper = strtoupper($string); print("$lower\n"); print("$upper\n"); print("\n"); ?>
The output results are as follows:
learn php string functions at jb51.net LEARN PHP STRING FUNCTIONS AT JB51.NET
Note:
strtolower() function converts the string to lowercase.
lcfirst() - Convert the first character in the string to lowercase
strtoupper() - Convert the string to uppercase
ucfirst() - Convert the string to uppercase Convert the first character of each word to uppercase
ucwords() - Convert the first character of each word in the string to uppercase
[Recommended learning: PHP video tutorial]
The above is the detailed content of How to convert characters to lowercase in php. For more information, please follow other related articles on the PHP Chinese website!