Search code snippets, questions, articles...

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
?>
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place.

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?
0 Comments