Title: PHP Logic Script with check Browser Language
Last modified: August 5, 2019

---

# PHP Logic Script with check Browser Language

 *  [pb75](https://wordpress.org/support/users/pb75/)
 * (@pb75)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/php-logic-script-with-check-browser-language/)
 * Hi, I’m trying to find a way to show widgets depending on the Users Browser Language.
   I tried seveal things but nothing worked. Do you have any idea?
    here is an example
   I tried:
 * if (($lang==”en_EN”) OR ($lang==”en-EN”) OR ($lang==”de_CH”) OR ($lang==”de-CH”)
   OR ($lang==”de_DE”) OR ($lang==”de-DE”)) {
    return true; }else { return false;}
    -  This topic was modified 6 years, 10 months ago by [pb75](https://wordpress.org/support/users/pb75/).
    -  This topic was modified 6 years, 10 months ago by [pb75](https://wordpress.org/support/users/pb75/).

Viewing 1 replies (of 1 total)

 *  Thread Starter [pb75](https://wordpress.org/support/users/pb75/)
 * (@pb75)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/php-logic-script-with-check-browser-language/#post-11806125)
 * I got it!! Yeah! Here’s the code:
 *  $http_lang = substr($_SERVER[“HTTP_ACCEPT_LANGUAGE”],0,5);
    switch ($http_lang){
   case ‘de-CH’: return true; break; case ‘de-ch’: return true; break; default: 
   return false; }
    -  This reply was modified 6 years, 10 months ago by [pb75](https://wordpress.org/support/users/pb75/).

Viewing 1 replies (of 1 total)

The topic ‘PHP Logic Script with check Browser Language’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/widget-logic_c8dde5.svg)
 * [Widget Logic](https://wordpress.org/plugins/widget-logic/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/widget-logic/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/widget-logic/)
 * [Active Topics](https://wordpress.org/support/plugin/widget-logic/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/widget-logic/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/widget-logic/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [pb75](https://wordpress.org/support/users/pb75/)
 * Last activity: [6 years, 10 months ago](https://wordpress.org/support/topic/php-logic-script-with-check-browser-language/#post-11806125)
 * Status: not resolved