How to extract numbers from phone number input field (PHP)

Use preg_replace to remove any non-digits:

$numbers = preg_replace('/[^\d]/','',$Phone);

Note: '[^\d]' can be replaced with '\D' (safe in non-unicode mode).



Popular Topics

Recent Languages