- preg_match: documentation ( source)
- print_r: documentation ( source)
<?php
$test = array(
'+380671072122','+3 80671072122','+3 8 067 107 21 22','+38(067)1072122','+38 (067) 107 21 22','+3 8067 107-21-22','067 107 21 22','067-107-21-22'
);
foreach($test as $t){
preg_match('/^(\+?\d{1})?\s*(\(\d+\))?[\s-]*([\d-]*)$/', $t, $number);
print_r($number);
}