fork download
  1. <?php
  2. $a = "8(911)-566-87 56";
  3. $b = '/^8-?\\s?\\(?\\d{3}\\)?-?\\s?\\d{3}-?\\s?\\d{2}-?\\s?\\d{2}$/';
  4. if (preg_match($b, $a)) {
  5. echo "ok";
  6. } else {
  7. echo "not ok";
  8. }
  9.  
  10. // your code goes here
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
ok