Skip to content

Instantly share code, notes, and snippets.

@ALTELMA
Last active December 8, 2016 08:43
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 ALTELMA/7906d55d8246bd95a3ccd9b9132345fd to your computer and use it in GitHub Desktop.
Save ALTELMA/7906d55d8246bd95a3ccd9b9132345fd to your computer and use it in GitHub Desktop.
PHP Practice
<?php
function is_anagram($a, $b) {
return(count_chars($a, 1) == count_chars($b, 1));
}
?>
<?php
function palindrome($str) {
if ((strlen($str) == 0)) {
return false;
}
if ((strlen($str) == 1)) {
return true;
} else {
if (substr($str,0,1) == substr($str,(strlen($str) - 1),1)) {
return palindrome(substr($str,1,strlen($str) -2));
} else {
return false;
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment