Created
June 7, 2018 07:00
-
-
Save niravmadariya/8b6d594644da89c20ebebe1c15a7a410 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head><title>Reverse of a given Number in PHP</title></head> | |
<body> | |
<form method="post"> | |
Enter the Number:<br> | |
<input type="number" name="number" id="number"> | |
<input type="submit" name="submit" value="Submit" /> | |
</form> | |
<?php | |
if($_POST['submit']){ | |
$num = $_POST['number']; | |
$revnum = 0; | |
while ($num > 1) | |
{ | |
$rem = $num % 10; | |
$revnum = ($revnum * 10) + $rem; | |
$num = ($num / 10); | |
} | |
echo "Reverse number of 23456 is: $revnum"; | |
} | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment