$my_str="Hello welcome to plus2net.com";
$my_str=strtoupper($my_str);
echo $my_str;
Above code output will be
HELLO WELCOME TO PLUS2NET.COM
Syntax
$val=strtoupper($input_sting);
We can use strtoupper() function in PHP to change all the alphabetic characters to uppercase. This simple function takes one string as input and changes the characters present inside to uppercase.
When comparing user input, converting both inputs to uppercase ensures case-insensitivity:
$input = "hello";
if (strtoupper($input) === strtoupper("HELLO")) {
echo "Inputs match!";
}
For handling multibyte characters, use *mb_strtoupper()* instead:
$str = "élève";
echo mb_strtoupper($str); // Outputs: ÉLÈVE
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.