php

Convert string to uppercase in PHP

If you need to convert a string to uppercase in PHP, you can use the strtoupper() function. This function takes a string as an argument and returns a string with all uppercase letters.

<?php
  echo strtoupper("We are ProgRammers");
  // -> WE ARE PROGRAMMERS
?>

Here, we are using strtoupper() function to convert all the characters to uppercase using PHP. The function converts each character of the string to uppercase.

Syntax

strtoupper($str)

More examples:

echo strtoupper("make the WORLD a Beautiful Place");
// -> MAKE THE WORLD A BEAUTIFUL PLACE
echo strtoupper("Hello world");
// -> HELLO WORLD
Was this helpful?