use $_SERVER['HTTP_ACCEPT_LANGUAGE']

John M wrote:

Hello,

I have the code below, but it doesn't work. I see the message "It is an
array" but nothing else. What can be the problem?
How can I get the actual browser language?

I use WinXp Prof, Apache 2.0.43, PHP 4.2.3, safe_mode is on.

Thanks!

<?php
global $HTTP_ACCEPT_LANGUAGE;
$arr_lang = preg_split('/(\s*,\s*)/', $HTTP_ACCEPT_LANGUAGE);
if (is_array($arr_lang)) {
echo "It is an array";
$lang_first = strtolower((trim(strval($arr_lang[0]))));
echo $lang_first;
$lang_first = substr($lang_first, 0, 2);
$lang = $lang_first;
echo $lang;
}
?>





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to