title: App: use address book to find friends::: How to deal with country codes
body: <p>I am working on a social network. I need to add a "find-friends" feature based on users' phone number and their address book (like whatsapp and others). </p>
  
  <p>The app I am developing will be available globally and I was wondering how others deal with the problem of predials and country codes. Of course I could find a way around but I am sure this is a relatively common challenge associated with that feature. The problem is, some people save numbers with a country code and some people don't. Do i need two versions of a phone number in my database?</p>
  
  <p>What I think about doing: </p>
  
  <p>1) user registers with the number and types in the country code and the rest of the number separately (two text fields). Then there are two separate columns in the database. One with the whole number including the country code and another with the number  excluding the country code.</p>
  
  <p>2) Then another user looks for friends via its address book.  In the PHP, each number is checked and the ones that start with "00" are compared against the numbers in the column of the international numbers. Vice versa, the ones that don't start with "00" are compared against the number without the country code. This way users can find their friends irrespective of how they saved their number. </p>
  
  <p>I would appreciate any help, links, advice or direction. I am looking for best practice approaches. </p>
  
  <p>Thanks! </p>