You will need the intl php extention in order for this to work.
After reading the class PhoneNumber.php under Zend\I18n\Validator. I came up with this.
$post is the form post where the user sends country e.g. GB, the country code e.g. 44, 0044, +44, and the phone number. if i remember correctly the class handles 00 and + but you should confirm.
$phone = new \Zend\I18n\Validator\PhoneNumber();//phone validation $phone->setCountry($post->country);//set the country (e.g CY)
switch ($post) {
case !$phone->isValid($post->phone_country_code.$post->phone, array('national'))://check if country and phone are valid
$msg = 'The Phone you Entered is Not valid. Please check the country code and phone and try again.';
break;
default:
$msg=null;
break; }