fork(54) download
  1. <?php
  2.  
  3. $in = 79817778833;
  4. $out = preg_replace(
  5. '/^(\d)(\d{3})(\d{3})(\d{2})(\d{2})$/',
  6. '+\1(\2)\3-\4-\5',
  7. (string)$in
  8. );
  9.  
  10. echo($out);
  11.  
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
+7(981)777-88-33