How to convert characters to lowercase in php

藏色散人
Release: 2023-03-09 06:34:01
Original
1854 people have browsed it

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.

How to convert characters to lowercase in php

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

The output results are as follows:

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

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!

Related labels:
php
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!