strtoupper()¶
strtoupper() converts all ASCII alphabetic characters in a string to uppercase.
It only handles the 26 ASCII letters (a–z). Characters outside the ASCII range are not converted. For Unicode-aware uppercasing, use mb_strtoupper(), which respects the string encoding.
strtoupper() is used for display normalisation, case-insensitive comparisons, and formatting constants or labels.
<?php
echo strtoupper('hello world'); // HELLO WORLD
echo strtoupper('php 8.4'); // PHP 8.4
// Unicode-aware version
echo mb_strtoupper('héllo', 'UTF-8'); // HÉLLO
?>
See also PHP strtoupper() and strtolower() Functions: A Complete Guide.
Related : strtolower(), String, Case Sensitivity, Multibyte String, setlocale