Location: PHPKode > scripts > Check Palindrome > check palindrome/checkPalindrome.php
<?php
/*
** Please do not remove this comment!
** Use of this Software implies explicit agreement to the Terms of
** Use (http://artbyjb.com/terms/) and the End-User Software License
** Agreement (http://artbyjb.com/terms/eula). This Software is
** provided on an "as-is" basis and cannot be guaranteed to be free
** of defects or that the Software will meet your requirements.

** Title: Check Palindrome
** Description: This PHP script checks a string against it's reversed self to determine if it's a palindrome.

** Author: Jeffrey Bennett
** URL: http://artbyjb.com/code/?p=2
** Date: December 7, 2010

** @access	public
** @param	string	$string	(required)
** @return	bool // True/False
*/

function checkPalindrome($string) {
 $string = preg_replace("/[^a-z0-9]/", "", strtolower($string));
 if ($string == strrev($string)) {
  return true;
 } else {
  return false;
 }
}
?>
Return current item: Check Palindrome