title: Using accept language header to guess user's country, if available
body: <p>I want to use Javascript/PHP to determine if a user's browser has a country (locale variant) defined in the accept-language header.</p>
  <p>Knowing that the contents of the accept-language header value can vary, and is not always accurate, is there a way to logically determine if a country present in the accept-language header string? And then extract that via JS?</p>
  <p>For example, if a user's accept language header contains en-US, I would want to set a local variable=&quot;US&quot;.</p>
  <p>My intial thought was to create a very large array of all accept header language and locale values and check against that, but that did not seem like a very efficient approach.</p>