Guest User

Untitled

a guest
Nov 23rd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. <?php
  2.  
  3. $data = '+11234567890';
  4.  
  5. if( preg_match( '/^\+\d(\d{3})(\d{3})(\d{4})$/', $data, $matches ) )
  6. {
  7. $result = $matches[1] . '-' .$matches[2] . '-' . $matches[3];
  8. return $result;
  9. }
Add Comment
Please, Sign In to add comment