src/Http.php
public static function getLanguages() {
    if(null === self::$languages) {
      // The pattern to match languages.
      $pattern = '/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i';

      // Get a list of languages.
      $languages = explode(',', @trim($_SERVER['HTTP_USER_AGENT']));

      // Any matches?
      $matches = array();
      if(preg_match($pattern, $languages, $matches) && 0 < count($matches[1])) {
        self::$languages = array_combine($matches[1], $matches[4]);
      } else {
        self::$languages = [];
      }
    }
    return self::$languages;
  }
public static function getLanguages() {
    if(null === self::$languages) {
      // The pattern to match languages.
      $pattern = '/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i';

      // Get a list of languages.
      $languages = explode(',', @trim($_SERVER['HTTP_USER_AGENT']));

      // Any matches?
      $matches = array();
      if(preg_match($pattern, $languages, $matches) && 0 < count($matches[1])) {
        self::$languages = array_combine($matches[1], $matches[4]);
      } else {
        self::$languages = [];
      }
    }
    return self::$languages;
  }
public static function getLanguages ( ) { if ( null === self :: $ languages ) { // The pattern to match languages. $ pattern = '/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i' ; // Get a list of languages. $ languages = explode ( ',' , @ trim ( $ _SERVER [ 'HTTP_USER_AGENT' ] ) ) ; // Any matches? $ matches = array ( ) ; if ( preg_match ( $ pattern , $ languages , $ matches ) && 0 < count ( $ matches [ 1 ] ) ) { self :: $ languages = array_combine ( $ matches [ 1 ] , $ matches [ 4 ] ) ; } else { self :: $ languages = [ ] ; } } return self :: $ languages ; }
Returns a list of detected languages that the user-agent currently
supports. The accuracy of this list is on par with that of the relevant
header sent by the remote browser.

@return array
Returns a list of detected languages that the user - agent currently supports . The accuracy of this list is on par with that of the relevant header sent by the remote browser .