Thanks for the info. Can we please go 1 step further?
What if the $phone does not have the proper digits, how would you do it so it just stays as is?
example:
$phone = 1234567
result should stay as is 1234567.
Basically, what I am trying to achieve here is how to dynamically format a string to a specified format, anyone have codes similar to this.
format passed = (ddd) ddd-dddd
or
format passed = 1-ddd-ddd-dddd
something like this... formatstring($phone, $format)
Thanks again for the help, you guys are awesome.