format phone number

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dimava
    Senior Member
    • Jul 2001
    • 518

    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
  • noppid
    Senior Member
    • May 2003
    • 625
    • 2.3.2

    #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

    • Lats
      Senior Member
      • Mar 2002
      • 3671

      #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...
      Lats...

      Comment

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