PHP program to convert the reverse case of an input character
ADVERTISEMENTS
In this article, you will learn how to convert the reverse case of an input character in the PHP programming language.
Examples
'e' after conversion 'E'
'E' after conversion 'e'
You should have knowledge of the following topics in PHP programming to understand this program:
- PHP
String
functions - PHP
if-else
condition statement
Source Code
<?php
// PHP program to convert the reverse case of an input character
$random_char = 'e';
echo "The Reverse case of the '" . $random_char . "' is: '";
if (ctype_lower($random_char))
echo strtoupper($random_char) . "'\n";
else
echo strtolower($random_char) . "'\n";
?>
Output
The Reverse case of the 'e' is: 'E'
Explanation
In this given program, we have taken input e
from the user and applied the function to convert the input's reverse case.