Contact: aviboots(AT)netvision.net.il
40,875 questions
53,283 answers
573 users
$str = "rotator"; if (strcmp($str, strrev($str)) == 0) echo "Palindrome"; else echo "Not Palindrome"; /* run: Palindrome */
function is_palindrome($string) { $string = strtolower(preg_replace("/[^A-Za-z0-9]/","", $string)); return $string == strrev($string); } $string = "ro.tat#or"; echo is_palindrome($string) ? "yes" : "no"; /* run: yes */