<?php
$corectNumbers = array ( '84951234567' , '+74951234567' , '8-495-1-234-567' , ' 8 (8122) 56-56-56' , '8-911-1234567' , '8 (911) 12 345 67' ,
'8-911 12 345 67' , '8 (911) - 123 - 45 - 67' , '+ 7 999 123 4567' ,
'8 ( 999 ) 1234567' , '8 999 123 4567' ) ;
$reguexp = '/^[()+"\\s-]{0,4}[0-9][()+"\\s-]{0,4}[0-9][()+"\\s-]{0,4}[0-9][()+"\\s-]{0,4}[0-9][()+"\\s-]{0,4}[0-9][()+"\\s-]{0,4}[0-9][()+"\\s-]{0,4}[0-9][()+"\\s-]{0,4}[0-9][()+"\\s-]{0,4}[0-9][()+"\\s-]{0,4}[0-9][()+"\\s-]{0,4}[0-9][()+"\\s-]{0,4}$/' ;
for ( $i = 0 ; $i <= count ( $corectNumbers ) - 1 ; $i ++ ) {
echo "Вы ввели правильный номер.\n " ;
} else {
echo "Введите номер ввиде: 8ABCXXXXXXX.\n " ;
}
}
echo "Конец проверки правильных. \n " ;
$incorectNumbers = array ( '02' , '84951234567 позвать люсю' , '849512345' , '849512345678' , '8 (409) 123-123-123' , '7900123467' , '5005005001' , '8888-8888-88' ,
'84951a234567' , '8495123456a' ,
'+1 234 5678901' , // неверный код страны
'+8 234 5678901' , // либо 8 либо +7
'7 234 5678901' // нет +
) ;
for ( $i = 0 ; $i <= count ( $incorectNumbers ) - 1 ; $i ++ ) {
echo "Вы ввели правильный номер.\n " ;
} else {
echo "Введите номер ввиде: 8ABCXXXXXXX.\n " ;
}
}
?>
PD9waHAKCmVycm9yX3JlcG9ydGluZygtMSk7Cm1iX2ludGVybmFsX2VuY29kaW5nKCd1dGYtOCcpOwoKCiRjb3JlY3ROdW1iZXJzID0gYXJyYXkoJzg0OTUxMjM0NTY3JywgJys3NDk1MTIzNDU2NycsICc4LTQ5NS0xLTIzNC01NjcnLAonIDggKDgxMjIpIDU2LTU2LTU2JywgJzgtOTExLTEyMzQ1NjcnLCAnOCAoOTExKSAxMiAzNDUgNjcnLCAK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