Home  >  Article  >  Backend Development  >  How to convert English lowercase to uppercase in php

How to convert English lowercase to uppercase in php

WJ
WJOriginal
2020-05-30 14:42:4334247browse

php method to convert English lowercase to uppercase: first create a new "test.php" file; then create the code "$str = strtoupper($str)" in the file; finally run " localhost/test.php".

How to convert English lowercase to uppercase in php

Recommended: "PHP Video Tutorial"

##php Method to convert English primary school to uppercase:

The function of php to convert lowercase to uppercase is: strtoupper()

First create a new test.php file and add the following content:


<?php
  $str = "www.php.cn";
  $str = strtoupper($str);
  echo $str;
?>

Then run the file in the browser

How to convert English lowercase to uppercase in php

Function introduction:

strtoupper() Function converts a string to uppercase.

Note: This function is binary safe.

Related functions:

lcfirst() - Convert the first character in the string to lowercase
strtolower() - Convert the string to lowercase
ucfirst() - Convert the string to lowercase Convert the first character in the string to uppercase
ucwords() - Convert the first character of each word in the string to uppercase

Syntax:

strtoupper(string)

Parameters


string required. Specifies the string to be converted.

Return value: Returns the string converted to uppercase.


The above is the detailed content of How to convert English lowercase to uppercase 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