Hi everyone I have to determine if a word is a palindrome and so far I have this code:
<?php $word=$_POST['word']; $reverse=strrev($word); if ($word == $reverse) echo 'This word is a palindrome'; else echo 'This is not a palindrome'; ?>The only problem is I have to remove all spaces, apostrophes, commas, etcs.
For example I need the words Madam I’m Adam to come back as a palindrome.
I am not quite sure how to remove unwanted characters…I was told to use str_replace but I don’t know how to use that function. Any help would be great. Thanks