Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

strtoupper()

strtoupper() converts all ASCII alphabetic characters in a string to uppercase.

It only handles the 26 ASCII letters, from a to z. Characters outside the ASCII range are not converted. For Unicode-aware uppercase, 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

?>

Documentation

See Also