I need advice on how i should strip all characters in a string(including special chars) but leave numbers (0-9) and store this in a $formatted_string. Any ideas how i do this an easy way?
So if i have a string with value "abcd*()123" i want the output to be "123"
Thanks in advance. Anders
A relatively quick (and probably unsafe!) way of doing this would be:
$numbers_only = ereg_replace("[[0-9]]", "", $numbers_and_other_stuff);
"unsafe" because it turns '123abc()456' into '123456' which may not be what you want.
HTH,
AC