Home >Backend Development >PHP Problem >How to convert the first letter to lowercase in php

How to convert the first letter to lowercase in php

王林
王林Original
2021-07-07 15:09:232707browse

The way PHP converts the first letter to lowercase is to pass the string as a parameter to the lcfirst function, such as [lcfirst("Hello world!");]. The lcfirst function automatically converts the first character in a string to lowercase.

How to convert the first letter to lowercase in php

The operating environment of this article: windows10 system, php 7.3, thinkpad t480 computer.

There is a function in PHP that can easily convert the first character in a string to lowercase. It is the lcfirst function. Let's briefly introduce the lcfirst function.

lcfirst() function converts the first character in the string to lowercase and returns the converted string.

Grammar:

lcfirst(string)

Code example:

<!DOCTYPE html>
<html>
<body>

<?php
echo lcfirst("Hello world!");
?>  
  
</body>
</html>

Running results:

hello world!

Related video tutorial sharing: php video tutorial

The above is the detailed content of How to convert the first letter 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