How to convert a string to uppercase in PHP?

I want to display the title of the page and some sections in uppercase letters. I don’t know if I should try it with PHP or is there any other better way to convert text to uppercase?

<h1><?php echo $title; ?></h1>

You can do it with PHP using strtoupper() function.

$text = "lowercase text";
$uppercase = strtoupper($text);

echo $uppercase; 
// Outputs: "LOWERCASE TEXT"

So you can use the code like this.

<h1><?php echo strtoupper($title); ?></h1>

Or you can achieve your goal using CSS, I guess this is the better option.

    text-transform: uppercase;