Skip to content

Instantly share code, notes, and snippets.

@fatadz
Created May 12, 2019 06:37
Show Gist options
  • Save fatadz/641c427ba2f13d3074cbace208752c52 to your computer and use it in GitHub Desktop.
Save fatadz/641c427ba2f13d3074cbace208752c52 to your computer and use it in GitHub Desktop.
Check Palindrome Word
<?php
class Palindrome
{
public static function isPalindrome($word)
{
if($word && is_string($word)){
$word = strtolower($word);
$wordReverse = strrev($word);
$isPalindrome = $word==$wordReverse ? true : false;
}else{
$isPalindrome = false;
}
return $isPalindrome;
}
}
echo Palindrome::isPalindrome('Deleveled');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment