Announcement

Collapse
No announcement yet.

format phone number

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • format phone number

    Hi,

    I have a 10 number integer coming out of a database, I need to format it like this: #-###-###-####

    what would be the best way to do this? I looked up the number_format method, but it doesn't accept more than one way to format the number.

    thanks,

    Dimava
    NXSupport Admin

  • #2
    I don't think you can do it with an integer. You need a formatted string.
    Computer Help Forum
    An informed rider makes their first destination the motorcycle forum at rider info.

    Comment


    • #3
      Originally posted by Dimava
      I have a 10 number integer coming out of a database
      One of the rules of DB design "if you're not going to do math on a number, store it as a string", or words to that effect.

      When it's a string, you can do whatever you like with it...
      http://au3.php.net/manual/en/function.substr.php
      Lats...

      Comment

      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
      Working...
      X