2013-03-11 8 views

답변

7
if (preg_match('~^\d{10}$~', $str)) { ... } 

또는

if (ctype_digit($str) && strlen($str) == 10) { ... } 
3

예 : -

if(preg_match('/^\d{10}$/', $str)) 
    echo "A match was found."; 
} else { 
    echo "A match was not found."; 
} 
관련 문제