strtoupper

(PHP 4, PHP 5, PHP 7, PHP 8)

strtoupperMake a string uppercase

Descrição

strtoupper(string$string): string

Returns string with all ASCII alphabetic characters converted to uppercase.

Bytes in the range "a" (0x61) to "z" (0x7a) will be converted to the corresponding uppercase letter by subtracting 32 from each byte value.

This can be used to convert ASCII characters within strings encoded with UTF-8, since multibyte UTF-8 characters will be ignored. To convert multibyte non-ASCII characters, use mb_strtoupper().

Parâmetros

string

The input string.

Valor Retornado

Returns the uppercased string.

Registro de Alterações

VersãoDescrição
8.2.0 A conversão de maiúsculas e minúsculas não depende mais da localidade definida com setlocale(). Somente caracteres ASCII serão convertidos.

Exemplos

Exemplo #1 strtoupper() example

<?php
$str
= "Mary Had A Little Lamb and She LOVED It So";
$str = strtoupper($str);
echo
$str; // Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
?>

Notas

Nota: Esta função é compatível com dados binários.

Veja Também

  • strtolower() - Converte uma string para minúsculas
  • ucfirst() - Make a string's first character uppercase
  • ucwords() - Converte para maiúsculas o primeiro caractere de cada palavra
  • mb_strtoupper() - Faz uma string ficar em maiúsculas
To Top