Skip to content

Instantly share code, notes, and snippets.

@honno
Created June 3, 2018 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save honno/f9de45c4e62ba3841646c23b05c80ac0 to your computer and use it in GitHub Desktop.
Save honno/f9de45c4e62ba3841646c23b05c80ac0 to your computer and use it in GitHub Desktop.
<?php
function isPalindrome($string) {
if (strlen($string) <= 1) {
return true;
} elseif (strtolower(substr($string, 0, 1)) == strtolower(substr($string, -1))) {
isPalindrome(substr($string, 1, -1));
} else {
return false;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment