View Full Version : Help! Getting just letters

09-12-2009, 09:28 PM
I've been going crazy over this for hours. If I am given a string such as this:

$variable = "45$^nAm5e#";

How can I go about pulling ONLY the letters from that variable? In other words, is there a way to make it like this:

$variable = "nAme";


Thanks for any help!

09-12-2009, 10:48 PM
echo preg_replace("/[^a-zA-Z\s]/", "", $variable);