search
HomeBackend DevelopmentPHP ProblemContinue to destroy all characters in the string

In the previous article, we learned about how to change the case of the first character of a string. If you need it, please read "The first character of a string is a disaster!" 》. This time we will introduce to you how to change the case of string characters. You can refer to it if you need it.

We left two functions unmentioned before. I don’t know if you are still impressed. If it doesn’t affect you, read my last article again. This time we will introduce these two functions.

First of all, we introduce the function that converts all characters to uppercase.

Let’s look at a small example.

<?php
echo strtoupper("Hello WORLD!");
?>

The result is

Continue to destroy all characters in the string

We will know the meaning of this function by looking at the result. The strtoupper function can convert all characters in the string Convert to uppercase, so that when we view the output results, all characters will be uppercase.

After we know this function, let's take a look at its usage, give yourself a deeper influence, and remember this function.

strtoupper(要转换的字符串)

Now that we’ve finished talking about the function that converts all characters to uppercase, let’s talk about the function that converts all characters to lowercase.

Let’s take a look at a little chestnut.

<?php
echo strtolower("Hello WORLD.");
?>

This result is

Continue to destroy all characters in the string

The function of this function is opposite to the strtoupper function. It converts all the characters of the incoming character parameters into lowercase and ends with Returns this string in lowercase form. The usage is the same as strtoupper().

Although it's the same, let's take a look at the usage of this function to deepen our impression.

strtoupper(要转换的字符串)

Finally, let’s recommend a few commonly used functions.

When writing PHP programs, you often need to convert uppercase and lowercase strings, which are very useful. (ps: including those introduced before)

strtolower() //Convert the string to lowercase form

strtoupper() //Convert the string to uppercase form

lcfirst() //Convert the first character of the string to lowercase form

ucfirst() //Convert the first character of the string to uppercase

ucwords() //Convert the first letter of each word in the string That’s it for the capitalized form

. If you want to know anything else, you can click this. → →php video tutorial

The above is the detailed content of Continue to destroy all characters in the string. 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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function