/ Published in: PHP

Converts phone numbers to the formatting standard
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * Converts phone numbers to the formatting standard * * @param String $num A unformatted phone number * @return String Returns the formatted phone number */ function formatPhone($num) { if($len == 7) elseif($len == 10) return $num; } // echo formatPhone('1 208 - 386 2934'); // will print: (208) 386-2934 </code>
URL: http://www.bluefrog.ca/2011/12/simple-phone-number-format-function/
Comments
