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

PHP converts string to uppercase function strtoupper()

黄舟
黄舟Original
2017-11-06 10:42:031688browse

Example

Convert all characters to uppercase:

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

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)
Parameters Description
string Required. 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");
        }
    }


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!

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