0.8 $langs = array_combine($lang_parse[1], $lang_parse[4]); // set default to 1 for any without q factor foreach ($langs as $lang => $val) { if ($val === '') $langs[$lang] = 1; } // sort list based on value arsort($langs, SORT_NUMERIC); } } // look through sorted list and use first one that matches our languages foreach ($langs as $lang => $val) { if (strpos($lang, 'de') === 0) { header("Location: /ger/index.html"); exit(); } else if (strpos($lang, 'en') === 0) { header("Location: /eng/index.html"); exit(); } } ?>