good
Array
(
[0] => 1234567891
[1] => 123
[2] => 456
[3] => 7891
)
Valid number
show code
<?php
if ($_GET['phone'])
{
$match = preg_match("/(\d{3})(\d{3})(\d{4})/", $_GET['phone'], $matches);
echo ($match) ? "good<br>" : "bad<br>";
print_r($matches);
echo ($match) ? "Valid number" : 'Invalid number';
}
?>