Determining information about a phone number and reformatting in PHP

InnocentVictim

New Member
I'm looking for a way of determining whether a phone number is in the international format or a local format, and if it's in the international format what country it belongs to. If it's in the local format it should prompt the user for the country code and then convert it into the international format.Examples:
  • 00447749123123 = international UK number - reformat to 447749123123
  • +447749123123 = international UK number - reformat to 447749123123
  • 447749123123 = international UK number
  • 07749123123 = national UK number - prompt for country code and reformat to 447749123123
  • 18775784000 = international american number
  • 8775784000 = national american number - prompt for country code and reformat to 18775784000
Does anyone know if such a script exists, or if not how to go about doing this? IT should work for as many countries as possible (not just the UK and US).
 
Back
Top