Forum Moderators: coopster

Message Too Old, No Replies

Formatting numbers

         

Nutter

9:47 pm on Jun 11, 2006 (gmt 0)

10+ Year Member



Is there a built in function I'm missing that will format numbers similar to how the Visual Basic format will? Ex: ###-##-#### or 000-00-0000.

eelixduppy

10:59 pm on Jun 11, 2006 (gmt 0)



You might be able to achieve what you want using the number_format [php.net] function.

Nutter

11:14 pm on Jun 11, 2006 (gmt 0)

10+ Year Member



I actually just finished (about 5 minutes ago) writing a function that takes a format string and formats the number using it.

Say the number is 123456. If the format is W-00-00-00-00-W it will format it to W-00-12-34-56-W. If the format is W-#-W it will format it to W-123456-W.

Seems to work pretty well.

eelixduppy

2:05 am on Jun 12, 2006 (gmt 0)



I'm glad you got it ;)