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 ÄÜÖ
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 ConverterExample call for the conversion to uppercase:
<?php
require_once("CaseConverter.php");
$caseConverter = new CaseConverter();
echo $caseConverter->convertToCamelCase("Uppercase"); // UPPERCASE