Re: [PHP] formatting a numeric string

2002-04-10 Thread pong-TC
[EMAIL PROTECTED] writes: >I have the following code -- > >$phone_number = "8005551212"; >$phone_array = explode("", $phone_number); >$phone_number = sprintf("(%s%s%s) %s%s%s-%s%s%s%s", $phone_array[0], >$phone_array[1], $phone_array[2], $phone_array[3], $phone_array[4], >$phone_array[5], $phone

Re: [PHP] formatting a numeric string

2002-04-10 Thread Edward van Bilderbeek - Bean IT
try: print ereg_replace("^([0-9]{3})([0-9]{3})([0-9]*)$", "(\\1) \\2 - \\3", $phone_number); Greets, Edward - Original Message - From: "Erik Price" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, April 10, 2002 4:13 PM Subjec

[PHP] formatting a numeric string

2002-04-10 Thread Erik Price
I have the following code -- $phone_number = "8005551212"; $phone_array = explode("", $phone_number); $phone_number = sprintf("(%s%s%s) %s%s%s-%s%s%s%s", $phone_array[0], $phone_array[1], $phone_array[2], $phone_array[3], $phone_array[4], $phone_array[5], $phone_array[6], $phone_array[7], $phon