fork(1) download
  1. <?php
  2. $number = '8(911)-506-56-56';
  3. $regexp = '/[0-9]{1}[(?0-9)?]{3}[-?0-9]{2}[-?0-9]{3}[-?0-9]{2}/';
  4. $matches = array();
  5. if(preg_match($regexp,$number,$matches)){
  6. echo"Allright, thats the correct number\n ";
  7. }
  8. else{
  9. echo"Something wrong, lets try it again\n";
  10. }
  11.  
  12. var_dump($matches);
  13.  
  14. // your code goes here
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
Allright, thats the correct number
 array(1) {
  [0]=>
  string(11) "911)-506-56"
}