downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  

<http_negotiate_content_typeob_deflatehandler>
Last updated: Thu, 26 Jun 2008

http_negotiate_language

(PECL pecl_http:0.1.0-1.5.5)

http_negotiate_language — Negotiate clients preferred language

Description

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

This function negotiates the clients preferred language based on its Accept-Language HTTP 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).

Parameters

supported

array containing the supported languages as values

result

will be filled with an array containing the negotiation results

Return Values

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

Examples

Example #1 Using http_negotiate_language()

<?php
$langs
= array(
      
'en-US',// default
      
'fr',
      
'fr-FR',
      
'de',
      
'de-DE',
      
'de-AT',
      
'de-CH',
);

include
'./langs/'. http_negotiate_language($langs, $result) .'.php';

print_r($result);
?>



add a noteadd a note User Contributed Notes
Negotiate clients preferred language
There are no user contributed notes for this page.




<http_negotiate_content_typeob_deflatehandler>
Last updated: Thu, 26 Jun 2008
show source | credits | sitemap | contact | advertising | mirror sites
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://phpbuilder.com/
Last updated: Tue Nov 1 20:20:59 2005 EST
Columns / Articles | Tips / Quickies | News | News Linking and RSS Feeds | Shared Code Library
Mail Archives | Support / Discussion Forums | Get Started! Links | Contribute! | Docs