fork download
  1. <?php
  2. $numbers=array('8(911)-506 56 56',
  3. '8-911-50-656-56',
  4. '89115065656',
  5. '02',
  6. '8-(9)_115 _065 6-3-5',//HURRR DURRRR
  7. '89115065656 позвать Люду');
  8.  
  9. $regular='/^8((( |-|\(|\)|_|)*[0-9]( |-|\(|\)|_|)*){9})[0-9]$/';
  10. $matches=preg_grep($regular,$numbers);
  11. print_r($matches);
Success #stdin #stdout 0.06s 20520KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 8(911)-506 56 56
    [1] => 8-911-50-656-56
    [2] => 89115065656
    [4] => 8-(9)_115  _065 6-3-5
)