Home >Backend Development >PHP Tutorial >How to convert all strings to lowercase or uppercase in PHP

How to convert all strings to lowercase or uppercase in PHP

王林
王林Original
2019-12-03 09:18:286074browse

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!

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