Numer regularny PHP
$output = preg_replace( '/[^0-9]/', '', $string );
Dead Dingo
$output = preg_replace( '/[^0-9]/', '', $string );
$output = preg_replace("/\D+/", "", $input);