Last active
June 29, 2016 11:03
-
-
Save vc27/f805ba4db7a2aa529e66c1673e32e9ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function is_palindrome( $word ) { | |
return $word === strrev( $word ) ? true : false; | |
} | |
function print_palindrome($word) | |
{ | |
echo($word . " is a palindrome: " . (is_palindrome($word) ? "YES" : "NO") . PHP_EOL); | |
} | |
print_palindrome("MOM"); | |
print_palindrome("DOG"); | |
print_palindrome("RACECAR"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment