Re: Browser language problem

From: Date: Thu, 23 Jan 2003 18:54:52 +0000
Subject: Re: Browser language problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-132882@lists.php.net to get a copy of this message
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;
       }
?>


« previous php.general (#132882) next »