I’m looking for a function or some logic that will validate a 10 digit long phone number. I’d like to make sure that the number is exactly 10 digits, no letters, no hyphens etc.. And also need to check first digit of the number start with 0.
Eg: 0714556260
UPDATE
$test = 0714556260;
if (preg_match("|^[0-9]{10}$|", $test)) {
echo 'valid';
} else {
echo 'not valid';
}
1 Answer