Get the App
SLTechnology News&Howtos  ›  Development  › 

How php converts lowercase letters to uppercase

Shulou Source: shulou.com Published: 2022-06-03 11:44:16 09月20日 Update

This article mainly explains "how php converts lowercase letters to capitalization". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian slowly and deeply to study and learn "how php converts lowercase letters to capitalization" together!

Operating environment of this tutorial: Windows 7 system, PHP 7.1 version, DELL G3 computer

php There are three ways to convert lower-case letters to upper-case letters:

strtoupper() converts a string to upper case

ucfirst() converts the first letter of a string to upper case

ucwords() converts the first character of each word in a string to upper case

1) strtoupper

The strtoupper() function converts letters in a string to upper case in the following syntax:

strtoupper($str)

where $str is a string argument that converts the letters in the argument $string to uppercase and returns the converted string.

The sample code is as follows:

The results are as follows:

2) ucfirst

The ucfirst function converts the first letter of a string to upper case. The syntax format is as follows:

ucfirst($str)

where $str is the string to be converted.

The sample code is as follows:

The results are as follows:

Hello world! Hello world!

3) ucwords

The ucwords() function converts the first letter of each word in a string to upper case in the following syntax:

ucwords($str)

The sample code is as follows:

The results are as follows:

Hello World! Hello World! Thank you for reading, the above is "php how to convert lowercase letters to capitalization" content, after the study of this article, I believe we have a deeper understanding of how to convert lowercase letters to capitalization in php, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Tags: Uppercase letters characters strings lowercase functions code formats examples results grammar learning running content words parameters that is ideas situations tutorials Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Huawei Shulou Information Shulou Technology MariaDB