fork(5) download
  1. <?php
  2.  
  3. $phone = '(123) 458-1542';
  4. if(preg_match('~^\([0-9]{3}\)[- ][0-9]{3}-[0-9]{4}$~', $phone)) {
  5. echo "Matched: $phone";
  6. }
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
Matched: (123) 458-1542