Home > Article > Backend Development > PHP converts string to uppercase function strtoupper()
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+ |
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('pinyin:'.strtoupper($kw).'*'); }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!