Home > Backend Development > PHP Tutorial > How to convert to lowercase in php?

How to convert to lowercase in php?

烟雨青岚
Release: 2023-04-08 21:12:02
Original
2323 people have browsed it

How to convert to lowercase in php?

How to convert to lowercase in php?

1. Convert the string to lowercase

strtolower(): This function will convert all the characters in the string parameter passed in Converts both to lowercase and returns the string in lowercase.

Example:

<?php
    $str = "I want To FLY";
    $str = strtolower($str);
    echo $str;
?>
Copy after login

Output result:

i want to fly
Copy after login

2. Convert characters to uppercase

strtoupper(): The function of this function is the opposite of the strtolower function. It converts all the characters of the incoming character parameter into uppercase and returns the string in uppercase; Usage Same as strtolowe().

3. Convert the first character of the string to uppercase

usfilst(): The function of this function is to convert the first character of the string to uppercase If the character is changed to uppercase, this function returns a string with the first character in uppercase; the usage is the same as strtolowe().

4. Convert the first character of each word in the string to uppercase

ucwords(): This function converts the incoming string The first character of each word becomes uppercase; such as "hello world", after being processed by this function, "Hello Word" will be returned; the usage is the same as strtolowe().

Recommended tutorial: "php tutorial"

The above is the detailed content of How to convert to lowercase in php?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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