Skip to content

Instantly share code, notes, and snippets.

@vc27
Last active June 29, 2016 11:03
Show Gist options
  • Save vc27/f805ba4db7a2aa529e66c1673e32e9ba to your computer and use it in GitHub Desktop.
Save vc27/f805ba4db7a2aa529e66c1673e32e9ba to your computer and use it in GitHub Desktop.
<?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