Skip to content

Instantly share code, notes, and snippets.

@dakota
Created October 24, 2014 09:55
Show Gist options
  • Save dakota/182b3a74b7af988049bb to your computer and use it in GitHub Desktop.
Save dakota/182b3a74b7af988049bb to your computer and use it in GitHub Desktop.
<?php
$validator
->allowEmpty('number')
->add('number', 'valid', [
'rule' => function ($value) {
return preg_match('/^(((\+44)? ?(\(0\))? ?)|(0))( ?[0-9]{3,4}){3}$/', $value) === 1;
}
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment