[[!FormIt? &customValidators=`isPhone` &validate=`phone:isPhone`]]
<?php
$value;
$pattern = "/^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/";
/*** try to validate with the regex pattern ***/
if(filter_var($value, FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>$pattern))) === false)
{
return $value;
}
?>