Re: Get country from Phone number

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




----- Original Message ----- From: "Jim Lucas" <lists@xxxxxxxxx>
To: "Dani Castaños" <danitao.mailists@xxxxxxxxx>
Cc: "PHP LIST" <php-general@xxxxxxxxxxxxx>
Sent: Saturday, March 01, 2008 2:36 AM
Subject: Re:  Get country from Phone number


Dani Castaños wrote:
Hi all!

I'm looking for some piece of code or class which giving a phone number it returns me from wich country is this phone.
Do you know where I can find something like this?

Thank you in advanced!


As a little project, I took the link provided by "the other" Rob and make this little search tool.

It only looks at the beginning numbers. It does no number validation. I don't validate the length of the number. ie: I would have to know the min/max lenth of each phone number for that given country/region, and I didn't search for that information.

You can't check for length, that depends on each national administration and while some countries have all phone numbers exactly the same length, some other countries do it the old style: small phone exchanges have few digits, larger have more, which gets compensated by the smaller exchanges having longer area codes.

The idea is that within small towns, you dial short numbers to reach your neighbour and, if someone dials from outside the area, they have to dial a longer area code prefix, but since the town is small, there is a lesser chance that many people will have any business dialing them anyway so, overall, you get to dial less. Also, in electromechanical phone exchanges, each extra digit (actually couple of digits) requires an extra row of 'selectors', which are (were) expensive.

This still happens at the country level, not because it really matters nowadays but due to the existing technology when it was agreed on it. Large countries in Latin America have two digit country codes (political maneuvering at the time of assignment distorted this somewhat, letting Peru and Cuba get 2 digits which don't fit their actual number of phone lines). Thus, from 51 to 58 they are assigned to the larger countries. The 59x and 50x ranges (in phone numbering the zero is after the nine within the same decade) go to countries with less phone lines.

Satyam



Let me know what you'll think.

http://www.cmsws.com/examples/php/areacodes/countrycodes.php

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
No virus found in this incoming message.
Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.21.2/1305 - Release Date: 29/02/2008 18:32



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux