Program for palindrome in php

1 answer

Answer

1138521

2026-04-12 03:46

+ Follow

You could use a function like this:


function isPalindrome($string) {

$string = strtolower($string);

return (strrev($string) == $string) ? true : false;

}


and then to check a palindrome call an if statement like so:



if(isPalindrome($test)) {

echo $test.' is a palindrome';

}

else {

echo $test.' is not a palindrome';

}

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.