The characters read the same backward as forward. Some examples of palindromic words are redivider, deified, civic, radar, level, rotor, kayak, reviver, racecar, redder, madam, and refer.
function palindrome($string)
{
return strrev($string) == $string ? true : false;
}
Results
echo palindrome('SOOS') == true ? 'This is Palindrome' : 'This is not Palindrome';
Output: This is Palindrome
Explanation: Reversing SOOS will also get SOOS
echo palindrome('SOOSS') == true ? 'This is Palindrome' : 'This is not Palindrome';
Output: This is not Palindrome
Explanation: Reversing SOOSS will get SSOOS