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

王林
Release: 2023-04-07 21:34:02
Original
6133 people have browsed it

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");
?>
Copy after login

The output result is as follows:

learn php string functions at jb51.net
LEARN PHP STRING FUNCTIONS AT JB51.NET
Copy after login

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!

Related labels:
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template