SHARE
TWEET

Untitled

a guest May 22nd, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
  22. echo Palindrome::isPalindrome('Deleveled');
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top