RegEx does not allow 0 to be entered by phone number
4 answers
Only numbers that do not start with 0:
/^[1-9][0-9]+$/
Remove all leading spaces and zero:
$num = preg_replace('/^(?:0|\s)*([0-9]+)$/', '\1', ' 0999');
To remove all whitespace in a string, as well as those not maintained, use str_replace. This can be done with a regex, but if you are going to loop a lot of numbers that will be slower.
+4
source to share