0

in my website i have two options one is english and one is spanish.

for english=en-US,en;q=0.5 and for spanish=es-es, es; q = 0,5.

I used $lang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];

now i want to check the condition and chage the logo of my websites.but every time its gives me bad result.how can i do that.anyhelp will be appricated.

Sudhir Bastakoti
  • 99,167
  • 15
  • 158
  • 162
pratik
  • 983
  • 3
  • 13
  • 25

1 Answers1

2

you could do:

$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
switch ($lang){
    case "es":   //spanish
        include("logo_es.php");
        break;
    case "en":  //english and any other language
    default:
        //for english and default
        include("logo.php");
        break;
}
Sudhir Bastakoti
  • 99,167
  • 15
  • 158
  • 162