I am trying to display numbers retrieved from the database, in a specific format in a text box. There are two ways in which the numbers can be displayed.
- When the total numbers are 10 in database (4608061019) Expected output 46-0806-1019
- When the total numbers are 13 in database (4608061019100) Expected output 46-0806-1019-100
My progress so far:
While saving the value into the database I am using preg_replace("/[^0-9]/","",$string); // to make sure all hardcoded "-" are removed while storing.