Location: PHPKode > scripts > HTTP Locale > http-locale/HTTPLocale.class.php
<?
class HTTPLocale
{
  var $language;
  var $country;

  function HTTPLocale()
  {
    $data = array_map("trim", explode(",", $_SERVER["HTTP_ACCEPT_LANGUAGE"]));
    $data = array_map("trim", explode(";", $data[0]));
    $data = array_map("trim", explode("-", $data[0])); //get first pair of language-country
    
    $this->language = strtoupper($data[0]);
    $this->country  = strtoupper($data[1]);
  }
}

?>
Return current item: HTTP Locale