When I use Firefox to test this block of code, I get en-us,en;
en-us,en;
As of v5.3 PHP has function for that purpose:
$locale = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']);
See: http://php.net/manual/en/locale.acceptfromhttp.php