<?php
$correctNumbers = [
'84951234567', '+74951234567', '8-4955-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'
];
$incorrectNumbers = [
'02', '84951234567 позвать люсю', '849512345', '849512345678',
'8 (409) 123-123-123', '7900123467', '5005005001', '8888-8888-88',
'84951a234567', '8495123456a',
'+1 234 5678901',
'+8 234 5678901',
'7 234 5678901'
];
$regexp = '/^(\+ *7| *8)([ ()-]*\d){10}$/m';
$correctValues = 0;
$incorrectValues = 0;
foreach ($correctNumbers as $number){
$correctValues++;
}
}
foreach ($incorrectNumbers as $number){
$incorrectValues++;
}
}
$errorText = "сначала должно идти +7 или 8, за ними ровно 10 цифр, между которыми может быть любое число скобок, минусов, пробелов";
$result = (($correctValues == count($correctNumbers)) && ($incorrectValues == 0)) ?
"Проверка успешна" : "Проверка не успешна: ".$errorText; echo $result;
PD9waHAKIAplcnJvcl9yZXBvcnRpbmcoLTEpOwogCiRjb3JyZWN0TnVtYmVycyA9IFsgCiAgJzg0OTUxMjM0NTY3JywgICcrNzQ5NTEyMzQ1NjcnLCAnOC00OTU1LTEtMjM0LTU2NycsIAogICcgOCAoODEyMikgNTYtNTYtNTYnLCAnOC05MTEtMTIzNDU2NycsICc4ICg5MTEpIDEyIDM0NSA2NycsIAogICc4LTkxMSAxMiAzNDUgNjcnLCAnOCAoOTExKSAtIDEyMyAtIDQ1IC0gNjcnLCAnKyA3IDk5OSAxMjMgNDU2NycsIAogICc4ICggOTk5ICkgMTIzNDU2NycsICc4IDk5OSAxMjMgNDU2NycKXTsKJGluY29ycmVjdE51bWJlcnMgPSBbCiAgJzAyJywgJzg0OTUxMjM0NTY3INC/0L7Qt9Cy0LDRgtGMINC70Y7RgdGOJywgJzg0OTUxMjM0NScsICc4NDk1MTIzNDU2NzgnLCAKICAnOCAoNDA5KSAxMjMtMTIzLTEyMyc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