VOOZH about

URL: https://www.geeksforgeeks.org/php/php-strtoupper-function/

⇱ PHP strtoupper() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

PHP strtoupper() Function

Last Updated : 11 Sep, 2024

The PHP strtoupper() function converts all alphabetic characters in a given string to uppercase. It takes a string as an argument and returns a new string with all letters capitalized, leaving non-alphabetic characters unchanged.

Syntax

string strtoupper ( $string )

Parameter: The only parameter to this function is a string that is to be converted to upper case.

Return value: This function returns a string in which all the alphabets are uppercase. Examples:

Input : $str = "GeeksForGeeks"
strtoupper($str)
Output: GEEKSFORGEEKS

Input : $str = "going BACK he SAW THIS 123$#%"
strtoupper($str)
Output: GOING BACK HE SAW THIS 123$#%

Below programs illustrate the strtoupper() function in PHP:

Example: In this example we converts the string "GeeksForGeeks" to uppercase using strtoupper() and prints the result.


Output
GEEKSFORGEEKS

Example : In this example we converts the string "going BACK he SAW THIS 123$#%" to uppercase using strtoupper() and prints the result


Output
GOING BACK HE SAW THIS 123$#%
Comment
Article Tags: