<?php
header("Content-Type: text/plain; charset=utf-8"); ?>
<?php
$number = 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'); $number2 = 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' // нет +
);
function getNumber($array)
{
foreach ($array as &$number)
{
{
{
$number = "$number Неверно введен номер";
}
{
$number = "$number Неверно введен код страны";
}
}
else $number = "$number Неверный формат номера";
}
return $array;
}
PD9waHAKaGVhZGVyKCJDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9dXRmLTgiKTsKPz4gCjw/cGhwCm1iX2ludGVybmFsX2VuY29kaW5nKCJVVEYtOCIpOwokbnVtYmVyID0gYXJyYXkoJzg0OTUxMjM0NTY3JywgJys3NDk1MTIzNDU2NycsICc4LTQ5NS0xLTIzNC01NjcnLCAnOCAoODEyMikgNTYtNTYtNTYnLCAnOC05MTEtMTIzNDU2NycsICc4ICg5MTEpIDEyIDM0NSA2NycsICc4LTkxMSAxMiAzNDUgNjcnLCAnOCAoOTExKSAtIDEyMyAtIDQ1IC0gNjcnLCAnKyA3IDk5OSAxMjMgNDU2NycsICc4ICggOTk5ICkgMTIzNDU2NycsICc4IDk5OSAxMjMgNDU2NycpOwokbnVtYmVyMiA9IGFycmF5KCcwMicsICc4NDk1MTIzNDU2NyDQv9C+0LfQstCw0YLRjCDQu9GO0YHRjicsICc4NDk1MTIzNDUnLCAnODQ5NTEyMzQ1Njc4JywgCic4ICg0MDkpIDEyMy0xMjMtMTIzJywgJzc5MDAxMjM0NjcnLCAnNTAwNTAwNTAwMScsICc4ODg4LTg4ODgtODgnLAonODQ5NTFhMjM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