Warning: include(/home/flemingg/web/solitude/FinettoAdmin/FinettoFunctions.php) [function.include]: failed to open stream: No such file or directory in /home/.debauch/flemingg/web/solitude/Code/Palindrome/IsPalindrome.php on line 3
Warning: include() [function.include]: Failed opening '/home/flemingg/web/solitude/FinettoAdmin/FinettoFunctions.php' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in /home/.debauch/flemingg/web/solitude/Code/Palindrome/IsPalindrome.php on line 3
Warning: include(/home/flemingg/web/solitude/Templates/MainTemplateTop.php) [function.include]: failed to open stream: No such file or directory in /home/.debauch/flemingg/web/solitude/Code/Palindrome/IsPalindrome.php on line 4
Warning: include() [function.include]: Failed opening '/home/flemingg/web/solitude/Templates/MainTemplateTop.php' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in /home/.debauch/flemingg/web/solitude/Code/Palindrome/IsPalindrome.php on line 4
<?php
function isPalindrome($String){
/************************************************
V2.0 - Simplified to the point of being trivial.
Popping characters and recursing no longer occurs,
we strip the string down and then compare it with
the reverse.
This function takes in a $String and returns true if it
is a palindrome.
*************************************************
Example usage:
$String = "Madam, I'm Adam";
//Outputs: "Madam, I'm Adam" is a palindrome
if (isPalindrome($String)){
echo "\"" . $String . "\" is a palindrome";
}else{
echo "\"" . $String . "\" is not a palindrome";
}
***************************************************/
$String = strtolower($String);
$String = str_replace(array("\n","\t","\r"," "),"",$String);
$String = ereg_replace("[^A-Za-z0-9]+","",$String);
//if a string is the same as its reverse, it is a palindrome
return ($String == strrev($String));
}
?>
Warning: include(/home/flemingg/web/solitude/Templates/MainTemplateBottom.php) [function.include]: failed to open stream: No such file or directory in /home/.debauch/flemingg/web/solitude/Code/Palindrome/IsPalindrome.php on line 34
Warning: include() [function.include]: Failed opening '/home/flemingg/web/solitude/Templates/MainTemplateBottom.php' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in /home/.debauch/flemingg/web/solitude/Code/Palindrome/IsPalindrome.php on line 34