Home > Article > Backend Development > How to convert all strings to lowercase or uppercase in PHP
In php, you can use the two functions strtolower
and strtoupper
to convert all English characters in the string to lowercase or uppercase.
Function introduction:
strtolower()
The function converts a string to lowercase.
strtoupper()
Function converts a string to uppercase.
Related video tutorial recommendations: php video tutorial
The example is as follows:
<?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 result is as follows:
learn php string functions at jb51.net LEARN PHP STRING FUNCTIONS AT JB51.NET
Recommended related articles and tutorials: php tutorial
The above is the detailed content of How to convert all strings to lowercase or uppercase in PHP. For more information, please follow other related articles on the PHP Chinese website!