you want to replace anything that is not a number with nothingness.... remove all non-numbers
use a regular expression replace
[man]preg_replace[/man] or [man]reg_replace[/man]
for the preg_function
and digit 0-9 character is represented with a \d
\d means one digit
the negative of something looks like this [something] so
[\d]
means any one non-digit
a regular expression has delemiters... ill use //
the regularexpression to find a non-digit is
/[\d]/
so you end up with
$only_digits = preg_replace( '/[\d]/', '', $string );
this means find all non-digits and replace them with nothingness
a space is represented with \s
so to keep the spaces you would say
replace anything that is not a space or a digit with nothingness
/[\d\s]/
$digits_and_spaces = preg_replace( '/[\d\s]/', '', $string );
hopefully one of these will be usefull