Detect Browser Language in PHP

/**
 * Function detects browser language.
 * returns two-letter language code on success, FALSE on failure, or an empty string.
 */
function get_browser_language() {
      return substr( $_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2 );
}

No comments yet.

Leave a Reply