Guest User

Untitled

a guest
Jan 20th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. <?php
  2. class Palindrome
  3. {
  4. public static function isPalindrome($word)
  5. {
  6. $word = strtolower($word);
  7. $length = strlen($word);
  8.  
  9. for($i = 0; $i < $length; $i++)
  10. {
  11. if ($word[$i] != $word[$length - 1 - $i])
  12. {
  13. return false;
  14. }
  15. }
  16.  
  17. return true;
  18. }
  19. }
  20.  
  21. echo Palindrome::isPalindrome('Deleveled');
Add Comment
Please, Sign In to add comment