A palindrome is a word, phrase, or sequence that reads the same backward as forward, e.g., madam. Write a PHP function that checks whether a passed string is a palindrome or not, then call this function to check if "madam" is a palindrome
<?php
function
Palindrome(
$string
){
if
(
strrev
(
$string
)
==
$string
){
return
1;
}
else
{
return
0;
}
}
$original
=
"madam"
;
if
(Palindrome(
$original
)){
echo
"Palindrome"
;
}
else
{
echo
"Not a
Palindrome"
;
}
?>
Get Answers For Free
Most questions answered within 1 hours.