Hello! I need to delete the characteres that aren't alphabetical from a word..I mean...: $my_word= "hello & 1º" $my_result = "hello 1" I need to suprime the characters like $,%,&,/,( ... Does someone know some way to do it easely? Thanks Router 🙂
regex would probably be easiest.
e.g.: $str=preg_replace('/[a-zA-Z]/', '', $str);
you can add more characters you want to allow within the square bracket (but ^ has to stay first). Anything that is not in there will be removed.
Thank you very much!!! It works fine!! Thank you again xblue, for your help!! 🙂