<?php
$right = 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 1111' ) ;
$wrong = 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' // нет +
) ;
$regexp = '/^(\+7|8)([-]?[(]?[ ]?[\d][)]?[ ]?[-]?){10}$/i' ;
for ( $i = 0 ; $i <= ( count ( $rnumber ) - 1 ) ; $i ++ ) {
// Так можно сделать чтобы и правильные показывало echo "Номер {$rnumber2[$i]} правильный\n";
} else {
echo "Номер {$rnumber2 [$i ]} не правильный\n " ;
}
}
for ( $i = 0 ; $i <= ( count ( $wnumber2 ) - 1 ) ; $i ++ ) {
echo "Номер {$wnumber2 [$i ]} правильный\n " ;
} else {
echo "Номер {$wnumber2 [$i ]} не правильный\n " ;
}
}
PD9waHAKCiRyaWdodCA9IGFycmF5KCc4NDk1MTIzNDU2NycsICcrNzQ5NTEyMzQ1NjcnLCAnOC00OTUtMS0yMzQtNTY3JywgJyA4ICg4MTIyKSA1Ni01Ni01NicsICc4LTkxMS0xMjM0NTY3JywgJzggKDkxMSkgMTIgMzQ1IDY3JywgJzgtOTExIDEyIDM0NSA2NycsICc4ICg5MTEpIC0gMTIzIC0gNDUgLSA2NycsICcrIDcgOTk5IDEyMyA0NTY3JywgJzggKCA5OTkgKSAxMjM0NTY3JywgJzggOTk5IDEyMyAxMTExJyk7Cgokd3JvbmcgPSBhcnJheSgnMDInLCAnODQ5NTEyMzQ1Njcg0L/QvtC30LLQsNGC0Ywg0LvRjtGB0Y4nLCAnODQ5NTEyMzQ1JywgJzg0OTUxMjM0NTY3OCcsIAonO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