4 <?php include "skipif.inc"; ?>
6 HTTP_ACCEPT=text/html,text/plain,text/xml;q=0.1,image/*;q=0.1,*/*;q=0
7 HTTP_ACCEPT_CHARSET=utf-8,iso-8859-1;q=0.8,iso-8859-15;q=0
8 HTTP_ACCEPT_ENCODING=gzip,deflate;q=0
9 HTTP_ACCEPT_LANGUAGE=de-DE,de-AT;q=0.9,en;q=0.8,fr;q=0
16 print_r(array_map(function($v){return round($v,2);}, $ctr));
19 $ct = http\Env::negotiateContentType(array("text/html","text/xml","text/json"), $ctr);
20 echo "$ct: "; dump($ctr);
21 $ct = http\Env::negotiateContentType(array("text/xml","text/json"), $ctr);
22 echo "$ct: "; dump($ctr);
23 $ct = http\Env::negotiateContentType(array("text/json"), $ctr);
24 echo "$ct: "; dump($ctr);
30 $cs = http\Env::negotiateCharset(array("utf-8", "iso-8859-1", "iso-8859-15"), $csr);
31 echo "$cs: "; dump($csr);
32 $cs = http\Env::negotiateCharset(array("iso-8859-1", "iso-8859-15"), $csr);
33 echo "$cs: "; dump($csr);
34 $cs = http\Env::negotiateCharset(array("utf-16", "iso-8859-15", "iso-8859-2"), $csr);
35 echo "$cs: "; dump($csr);
41 $ce = http\Env::negotiateEncoding(array("gzip", "deflate", "sdch"), $cer);
42 echo "$ce: "; dump($cer);
43 $ce = http\Env::negotiateEncoding(array("", "sdch"), $cer);
44 echo "$ce: "; dump($cer);
50 $ln = http\Env::negotiateLanguage(array("de", "en", "fr"), $lnr);
51 echo "$ln: "; dump($lnr);
52 $ln = http\Env::negotiateLanguage(array("de-DE", "de-AT", "en"), $lnr);
53 echo "$ln: "; dump($lnr);
54 $ln = http\Env::negotiateLanguage(array("nl", "fr", "en"), $lnr);
55 echo "$ln: "; dump($lnr);
61 $cc = http\Env::negotiate("a, a.b;q=0.9, c.d;q=0, *.* ; q=0.1",
62 array("a.x", "c.d", "c.e", "a.b"), ".", $ccr);
63 echo "$cc: "; dump($ccr);