The strtoupper() function is used to convert a string into uppercase. This function takes a string as parameter and converts all the lowercase english alphabets present in the string to uppercase. All other numeric characters or special characters in the string remains 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:
Program 1
<?php // original string $str = "GeeksForGeeks"; // string converted to upper case $resStr = strtoupper($str); print_r($resStr); ?> |
Output:
GEEKSFORGEEKS
Program 2
<?php // original string $str = "going BACK he SAW THIS 123$#%"; // string to upper case $resStr = strtoupper($str); print_r($resStr); ?> |
Output:
GOING BACK HE SAW THIS 123$#%
Reference:
http://php.net/manual/en/function.strtoupper.php
Recommended Posts:
- How to get the function name inside a function in PHP ?
- PHP 5 vs PHP 7
- PHP | Get PHP configuration information using phpinfo()
- PHP | php.ini File Configuration
- How to import config.php file in a PHP script ?
- PHP | imagecreatetruecolor() Function
- PHP | fpassthru( ) Function
- PHP | ImagickDraw getTextAlignment() Function
- PHP | Ds\Sequence last() Function
- PHP | Imagick floodFillPaintImage() Function
- Function to escape regex patterns before applied in PHP
- PHP | array_udiff_uassoc() Function
- PHP | geoip_continent_code_by_name() Function
- PHP | GmagickPixel setcolor() function
- PHP | opendir() Function
- PHP | cal_to_jd() Function
- PHP | stream_get_transports() Function
- PHP | Ds\Deque pop() Function
- PHP | SimpleXMLElement children() Function
- PHP | array_intersect_ukey() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

