busboy — 2010-12-11T19:10:43-05:00 — #1
I have a field that requires only numbers on one of my forms. Is there a function that would strip out all letters and just leave the numbers?
anthonysterling — 2010-12-11T19:17:06-05:00 — #2
preg_replace would do it with an appropriate pattern.
preg_replace('~[^0-9]~', null, $string);
busboy — 2010-12-16T18:34:34-05:00 — #3
I tried that and it didn't work. I was still able to fill out the form with the following data:
123 E. Main
Shouldn't the code snip that you provided reduced the string to:
felgall — 2010-12-16T23:04:49-05:00 — #4