Home  >  Article  >  Backend Development  >  How to convert characters to lowercase in php

How to convert characters to lowercase in php

藏色散人
藏色散人Original
2021-03-26 09:26:261826browse

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

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!

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