Validate North America Phone Number


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function fnValidatePhone($mValue)
  2. {
  3. $sPattern = '/^[\(]?[0-9]{3}[\)]?[-. ]?[0-9]{3}[-. ]?[0-9]{4}$/';
  4. return preg_match($sPattern, $mValue);
  5. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.