Advertisement
Guest User

Untitled

a guest
May 24th, 2019
89
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. $str = '';
  7. $word = strtolower($word);
  8.  
  9. $pjg = strlen($word);
  10. for ($x = $pjg; $x >= 0; --$x) {
  11. @$str .= $word[$x];
  12. }
  13. if ($word === $str) {
  14. return true;
  15. } else {
  16. return false;
  17. }
  18. return ($word === $str);
  19. }
  20. }
  21. echo Palindrome::isPalindrome('Deleveled');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement