Note that there are some explanatory texts on larger screens.

plurals
  1. PODetermining local / international phone numbers for the US
    primarykey
    data
    text
    <p>You're probably thinking this has been asked a million times before but I think that my question is a little different. Most requests for phone number validation are used for validating user input. In my scenario I'm trying to validating incoming phone calls to a US mobile phone, and determine whether they're calling from another country or from within the US.</p> <p>My main problem is that I'm based in the UK and have no experience of US phone numbers.. I've read about the format of how to dial etc (both international and national) but my worry is that the phone numbers appear differently on the recipient's phone, and in a variety of formats.</p> <p>Here is the specification of what I'm trying to do.. </p> <ul> <li>Imagine you are based in the US and are receiving a call on your mobile phone</li> <li>Determine whether the call is from a US or another country</li> <li>In the UK calls can come appear in the local or international format, it should be able to determine if it's a US number or not</li> <li>I believe international calls can be displayed on your phone in the format 0044 or +44 (if you were calling from the UK to the US)</li> <li>If the call is from within the US is it a valid phone number?</li> <li>Strip out all non numerical characters and reformat to national format. For example, the UK number 01530 123123 would get reformatted to 01530123123</li> <li>Strip out all non numerical characters and reformat to international format. For example, the UK number 01530 123123 would get reformatted to 00441530123123</li> </ul> <p>I'm trying to write the code in PHP and avoid regular expressions. I'm thinking it could use substr() to break down parts of the number.</p> <p>Any thoughts on how to go about this, code snippets or example phone numbers? I'm really hoping someone from the US will be able to enlighten me on phone number formatting etc..</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload