Here is an example how to convert a string "Kolkata" to uppercase "KOLKATA" using ord() function in PHP.
<html> <body> <?php $a="kolkata"; for($i=0;$i<strlen($a);$i=$i+1) { $a{$i}=chr(ord($a{$i})-32);//here ord($a{$i})will return the ASCII value of ith character, and chr(ord($a{$i})-32)will return the character in UPPERCASE from an ASCII value. //we know that the ASCII difference between the lowercase character and uppercase letter is 32. } echo "The string is in Uppercase:-"."<br>"; for($i=0;$i<strlen($a);$i=$i+1) { echo $a{$i}; } ?> </body> </html>
Output: The string is in Uppercase:-
KOLKATA