Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3498390
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:29:03+00:00 2026-05-18T12:29:03+00:00

You’re probably thinking this has been asked a million times before but I think

  • 0

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.

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.

Here is the specification of what I’m trying to do..

  • Imagine you are based in the US and are receiving a call on your mobile phone
  • Determine whether the call is from a US or another country
  • 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
  • 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)
  • If the call is from within the US is it a valid phone number?
  • Strip out all non numerical characters and reformat to national format. For example, the UK number 01530 123123 would get reformatted to 01530123123
  • Strip out all non numerical characters and reformat to international format. For example, the UK number 01530 123123 would get reformatted to 00441530123123

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.

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..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T12:29:04+00:00Added an answer on May 18, 2026 at 12:29 pm

    The people saying to just look for +1 have not worked with telephone numbers much. The 1 country code applies to many areas of North America not just the US. So what really needs to happen is some logic around the tables listed for the North American Numbering Plan and at the List of North American Numbering Plan area codes

    Here is a short list of some “exceptional” countries that have numbers starting in +1 that are not US based.

    Bermuda:

    • After 1995: +1 441 (xxx) xxxx

    Puerto Rico:

    • After 2001: +1 787 xxx xxxx or +1 939 xxx xxxx (overlay for entire island)

    US Virgin Islands:

    • After 1997: +1 340 xxx xxxx

    Northern Marianas:

    • After 1997: +1 670 xxx xxxx

    Guam:

    • After 1997: +1 671 xxx xxxx

    American Samoa:

    • After October 2, 2004: +1 684 xxx xxxx

    Saint Maarten:

    • After joining NANP: +1 721 xxx xxxx (date to be determined)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I have a JSP page retrieving data and when single or double quotes are
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.