PHP 8 reference · String Functions
PHP strtoupper() Function
Convert every ASCII letter in a string to uppercase. Letters such as é stay unchanged; use mb_strtoupper() for those.
PHP 8 Since 4.0
Syntax
strtoupper(string $string): string
Parameters
| Parameter | Description |
|---|---|
string |
The input string. |
Return value
The uppercased string.
Examples
<?php
echo strtoupper("camel case"), "\n";
echo strtoupper("order #a12-b"), "\n"; // digits and symbols stay
Output
CAMEL CASE ORDER #A12-B
<?php
echo strtoupper("café"), "\n";
echo mb_strtoupper("café"), "\n";
Output
CAFé CAFÉ
Version history
In other languages
str.upper()· Pythonstring.toUpperCase()· JavaScript
Related
strtolower()· Convert every ASCII letter in a string to lowercase. Since PHP 8.2 it ignores the locale; use mb_strtolower() for é, Ü and others.mb_strtoupper()· Convert a string to uppercase, including letters outside ASCII such as é, ß and Cyrillic. The Unicode-aware strtoupper().ucwords()· Uppercase the first letter of each word in a string. By default words are separated by spaces, tabs and new lines.- PHP Strings · tutorial