<?php
$correctNumbers = [
'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'
];
$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++;
}
}
$result = (($correctValues == count($correctNumbers)) && ($incorrectValues == 0)) ?
"Проверка успешна" : "Проверка не успешна"; echo $result;
PD9waHAKIAplcnJvcl9yZXBvcnRpbmcoLTEpOwogCiRjb3JyZWN0TnVtYmVycyA9IFsgCiAgJzg0OTUxMjM0NTY3JywgICcrNzQ5NTEyMzQ1NjcnLCAnOC00OTUtMS0yMzQtNTY3JywgCiAgJyA4ICg4MTIyKSA1Ni01Ni01NicsICc4LTkxMS0xMjM0NTY3JywgJzggKDkxMSkgMTIgMzQ1IDY3JywgCiAgJzgtOTExIDEyIDM0NSA2NycsICc4ICg5MTEpIC0gMTIzIC0gNDUgLSA2NycsICcrIDcgOTk5IDEyMyA0NTY3JywgCiAgJzggKCA5OTkgKSAxMjM0NTY3JywgJzggOTk5IDEyMyA0NTY3JwpdOwokaW5jb3JyZWN0TnVtYmVycyA9IFsKICAnMDInLCAnODQ5NTEyMzQ1Njcg0L/QvtC30LLQsNGC0Ywg0LvRjtGB0Y4nLCAnODQ5NTEyMzQ1JywgJzg0OTUxMjM0NTY3OCcsIAogICc4ICg0MDkpIDEyMy0xMjMtMTIzJywgJzc5MDAxMjM0NjcnLCAnNTAwNTAwNTAwMScsICc4ODg4LTg4ODgtODgnLA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