I'm trying to format a 10 digit phone number 1234567890
so that it would look like 123-456-7890
.
Note: my form simply takes a input type text
and inserted that to my database as the 10 digit above. But now if I want to echo this out, a correct format is what I need to show. The "design" of the form is not so much what I need help on but rather the "formatting" of the data. If the data was inserted as a non formatted 10 digit phone number without slashes or dashes in the the beginning of data input, or the way it was inserted into the database.
In other words, how would I format the unformatted or raw data in PHP so that it is echoed in certain format.