title: Mapping country code to country name php
body: <p>I have a function that I found on here to get the user ip to country. but it only shows the abrev I want to show the full country as well as the abrev</p>
  
  <pre><code>function ip_details($IPaddress)
  {
      $json       = file_get_contents("http://ipinfo.io/{$IPaddress}");
      $details    = json_decode($json);
      return $details;
  }
  
  $IPaddress  =  'get ip here';
  
  $details    =   ip_details("$IPaddress");
  
  echo $details-&gt;region;
  echo $details-&gt;country;
  </code></pre>
  
  <p>then I echo where I want it like this.</p>
  
  <pre><code>&lt;?php echo $details-&gt;country;?&gt;
  </code></pre>
  
  <p>So I went to <a href="https://ipinfo.io/developers/full-country-names" rel="nofollow noreferrer">IpInfo Site</a></p>
  
  <p>it tells me to download and map I have downloaded the json file but unsure how to map it so that I can echo out the full country name when needed</p>