There isn’t necessarily a one-to-one mapping; 44 for example, is used not just for the United Kingdom but for the Isle of Man, Guernsey and Jersey.
Numbers must also be altered according to where you’re dialing from.
However, it’s one thing to annoy users by making assumptions – asking a non-US user to provide a state and a zip-code.
It’s quite another to make a form completely unusable, for example by forcing people to provide numbers in a certain country’s format.
When a carrier runs out of one set of numbers – like, sadly, premium-rate – they simply introduce a new prefix.From abroad, to call a UK number you need to drop the leading zero and prefix with the dialing code 44: Thankfully, there is a format we can use which enable us to get around these variations.Luckily for developers there is an unambiguous, internationally recognized standard for telephone numbers anywhere in the World called E.164.For example, to find out whether a given dialing code is valid: There are a more efficent ways of doing this, of course, so this and the following examples aren’t necessarily optimized for production.We can look up the countries which use a particular dialing code: /** * Gets the dialing codes for a given country * * @param string country The two-character country code * @return array An array of strings representing the dialing codes */ get Codes : function(country) You’ll find these functions packaged up as a module, along with unit tests, in the repository that accompanies the article.