Home > PHP > Function > HTTP > http_negotiate_language()

http_negotiate_language()

http_negotiate_language - Negotiate clients preferred language

Syntax

string http_negotiate_language (array $supported, array &$result)

Arguments

  • supported - array containing the supported languages as values
  • result - will be filled with an array containing the negotiation results

Description

This function negotiates the clients preferred language based on its Accept-LanguageHTTP header. The qualifier is recognized and languages without qualifier are rated highest. The qualifier will be decreased by 10% for partial matches (i.e. matching primary language).

Version

PHP PECL pecl_http >= 0.1.0

Return value

Returns the negotiated language or the default language (i.e. first array entry) if none match.