In this PHP tutorial, you shall learn how to convert a given string to uppercase using strtoupper() function, with example programs.

PHP – Convert string to uppercase

To convert a string to uppercase in PHP, use strtoupper() function. Call strtoupper()and pass the given string as argument.


The syntax to convert the string str to uppercase using strtoupper() function is


The function returns a string value with all the characters in the given string converted to uppercase.



1. Convert string to uppercase

In this example, we will take a string str that has some lowercase characters. We convert this string to uppercase and print it.

PHP Program

  $str = 'Hello World';
  $output = strtoupper($str);
  echo $output;



In this PHP Tutorial, we learned how to convert a string to uppercase, using strtoupper() function.