PHP Function to test whether a given word is a palindrome or not. A Palindrome is a word which when reversed also gives the same word. This simple function helps in finding whether the given word is a palindrome or not.
function isWordPalindrome($word) {
$word = str_replace(' ', '', $word);
return $word == strrev($word);
}
function isWordPalindrome($word) {
$word = str_replace(' ', '', $word);
return $word == strrev($word);
}
No comments:
Post a Comment