Home > Backend Development > PHP Problem > How to convert string case in php

How to convert string case in php

王林
Release: 2023-03-03 17:26:01
Original
2921 people have browsed it

How to convert string case in php: You can use strtolower() function and strtoupper() function to achieve string case conversion. The strtolower() function converts a string to lowercase and returns the string converted to lowercase.

How to convert string case in php

In PHP, you can use the strtolower() function and strtoupper() function to achieve string case conversion. Let's introduce these two functions separately.

(Recommended tutorial: php graphic tutorial)

strtolower() function converts the string to lowercase and returns the string converted to lowercase.

Syntax:

strtolower(string)
Copy after login

strtoupper() function converts the string to uppercase and returns the string converted to uppercase.

Grammar:

strtoupper(string)
Copy after login

(Video tutorial recommendation: php video tutorial)

Code example:

Put all Convert characters to uppercase:

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

Convert all characters to lowercase:

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

The above is the detailed content of How to convert string case 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template