Saturday 29 June 2013

palindrome or not in php

<html>
<head>
<title> palindrome</title>
</head>
<?php
function pal()
{
$s=121;
$p=strrev($s);
if(strcmp($s,$p)==0)
{
echo " palindrome";
}
else
{
echo "not palindrome";
}

} pal();
?>
</body>
</html>

No comments:

Post a Comment