Posted By

fbnewtz on 09/20/06


Tagged

php format phone-number


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

vali29
willcodeforfood


Format a phone number in PHP


 / Published in: PHP
 

Use this to format a phone number for display on a page.

  1. function format_phnum($ac,$ph) {
  2. $areaCode = '(' . $ac . ') ';
  3. $npa = substr($ph,0,3) . '-';
  4. $num = substr($ph,3,4);
  5. return $areaCode . $npa . $num;
  6. }

Report this snippet  

You need to login to post a comment.