Professional Documents
Culture Documents
PHP 9
PHP 9
---------------------------------------------------------------------------------------------------------------------------
Assignment no: 9
Assignment Name: Write a PHP script to check whether a string is palindrome or not.
---------------------------------------------------------------------------------------------------------------------------
<html>
<head>
<meta name="viewport" content="width=device-width initial-scale=1"/>
</head>
<body align="center"><br>
<h2>THE PALINDROME NUMBER</h2><br><hr><br>
<form method="post">
<input type="text" name="str" required/><br>
<br><input type="submit" name="submit"/>
</form><br><hr><br>
</body>
</html>
<?php
if(isset($_POST['submit']))
{
$n=$_POST['str'];
$rev=strrev($n);
if($n==$rev)
{
echo "$n is Palindrome";
}
else
{
echo "$n is not Palindrome";
}
}
?>
Page no:-19