Home > Backend Development > PHP Tutorial > PHP converts string to uppercase function strtoupper()

PHP converts string to uppercase function strtoupper()

黄舟
Release: 2023-03-17 07:04:01
Original
1714 people have browsed it

Example

Convert all characters to uppercase:

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

Definition and usage

strtoupper() function converts a string to uppercase.

Note: This function is binary safe.

Related functions:

  • strtolower() - Convert the string to lowercase

  • lcfirst() - Convert the string to lowercase Convert the first character in the string to lowercase

  • ucfirst() - Convert the first character in the string to uppercase

  • ucwords() - Convert the first character in the string to uppercase Convert the first character of each word in the string to uppercase

Syntax

strtoupper(string)
Copy after login
ParametersDescription
stringRequired. Specifies the string to be converted.

Technical details

Return value: Returns the string converted to uppercase.
PHP version: 4+
## The strtoupper() function converts the string to uppercase

 public function set_kw($kw){
        $_intAsc=ord(substr($kw,0,1));
        if(($_intAsc>64 and $_intAsc<91)or($_intAsc>96 and $_intAsc<123)){
            $this->set_query_q(&#39;pinyin:&#39;.strtoupper($kw).&#39;*&#39;);
        }else{
            $this->set_dismax_model();
            $this->set_query_q($kw);
            $this->set_query_qf("name^10 address^5");
        }
    }
Copy after login


The above is the detailed content of PHP converts string to uppercase function strtoupper(). 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