Convert text to Upper Case in PHP - toolpage.org
Uppercase Converter

Convert text to Upper Case in PHP

Texts can easily be converted to uppercase in PHP, appropriate functions are already available for this purpose. The simplest function is strtoupper():

<php echo strtoupper("Uppercase"); // UPPERCASE

A more complex but also more powerful function is mb_strtoupper(). It supports Unicode and also enables language-dependent conversion of letters, such as the capitalization of German umlauts.

<php echo mb_strtoupper("Uppercase", "UTF-8"); // UPPERCASE

Consideration of German umlauts in uppercase:

<php setlocale(LC_CTYPE, 'de_DE.UTF8'); echo mb_strtoupper('uppercase äüö', 'UTF-8'); // UPPERCASE ÄÜÖ

Using the PHP CaseConverter library

To capitalize single strings or texts in your PHP programs, you can also use our CaseConverter class, which you can find on GitHub. It offers many other methods for converting the case of strings:

PHP Case Converter
https://github.com/toolpage/php-case-converter

Example call for the conversion to uppercase:

<?php require_once("CaseConverter.php"); $caseConverter = new CaseConverter(); echo $caseConverter->convertToCamelCase("Uppercase"); // UPPERCASE