To convert a string to uppercase in PHP, you can use the strtoupper()
function. This function converts all the characters of a string to uppercase, and returns the modified string.
For example:
$string = 'hello';
$string = strtoupper($string);
// $string will be equal to 'HELLO'
You can also use the mb_strtoupper()
function to convert a multibyte string to uppercase. This function requires the mbstring
extension to be enabled in your PHP configuration.
For example:
$string = 'héllo';
$string = mb_strtoupper($string, 'UTF-8');
// $string will be equal to 'HÉLLO'