30 seconds of PHP

  Back to Home

palindrome

stringbeginner

Returns true if the given string is a palindrome, false otherwise.

Check if the value of strrev($string) is equal to the passed $string.

function palindrome($string)
{
  return strrev($string) === (string) $string;
}