35. PHP Program to read a character and find out whether it is Uppercase or Lowercase.
How does this program work?
- In this program you are going to learn about how to read a character in PHP.
- And find out whether it is uppercase or lowercase letter.
Here is the code
<html>
<head>
<title>PHP Program To Check whether given character is Uppercase or Lowercase</title>
</head>
<body>
<form method="post">
<table border="0">
<tr>
<td> <input type="text" name="num" value="" placeholder="Enter any letter"/> </td>
</tr>
<tr>
<td> <input type="submit" name="submit" value="Submit"/> </td>
</tr>
</table>
</form>
<?php
if(isset($_POST['submit']))
{
$ch = $_POST['num'];
if($ch >= 'A' && $ch <= 'Z')
{
echo " $ch is a uppercase alphabet. ";
}
else if($ch >= 'a' && $ch <= 'z')
{
echo " $ch is a lowercase alphabet. " ;
}
else
{
echo "$ch is not an alphabet.";
}
return 0;
}
?>
</body>
</html>