Skip to content

Instantly share code, notes, and snippets.

@yohangdev
Created January 17, 2019 08:28
Show Gist options
  • Select an option

  • Save yohangdev/c651639c00ebbc1ea0d61a551e58a80c to your computer and use it in GitHub Desktop.

Select an option

Save yohangdev/c651639c00ebbc1ea0d61a551e58a80c to your computer and use it in GitHub Desktop.
PHP #1 - Palindrome
<?php
class Palindrome
{
public static function isPalindrome($word)
{
$toLowercase = strtolower($word);
$wordLength = strlen($toLowercase);
for ($n = 0; $n < $wordLength; $n++) {
if ($toLowercase[$n] !== $toLowercase[$wordLength-$n-1]) {
return false;
}
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment