How to convert string to lowercase in php

青灯夜游
Release: 2023-03-09 18:16:02
Original
4427 people have browsed it

php method to convert a string to lowercase: 1. strtolower() function, which can convert all letters in the string to lowercase, the syntax is "strtolower (string)"; 2. lcfirst() function , you can convert the first character in the string to lowercase, the syntax is "lcfirst(string)".

How to convert string to lowercase in php

The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

php can change characters Convert string to lowercase

Method 1: Use strtolower() function

strtolower() function to convert string to lowercase.

Syntax:

strtolower(string)
Copy after login

Example:

Copy after login

Output:

hello world!
Copy after login

Method 2: Use lcfirst() function

lcfirst() function converts the first character in a string to lowercase.

Grammar:

lcfirst(string)
Copy after login

Example:

Copy after login

Output:

hELLO WORLD!
Copy after login

Recommended learning: "PHP Video Tutorial"

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

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