1 # static string http\Env::negotiateContentType(array $supported[, array &$result])
3 Negotiate the client's preferred MIME content type.
6 > The first element of $supported content types serves as a default if no content-type matches.
11 List of supported MIME content types.
12 * Optional array &$result
13 Out parameter recording negotiation results.
17 * NULL, if negotiation fails.
18 * string, the negotiated content type.
22 A client indicates his accepted MIME content types by sending an Accept
23 header. The static http\Env class provides a facility to negotiate the
24 client's preferred content type:
27 $_SERVER["HTTP_ACCEPT"] = implode(",", array(
40 $preferred = http\Env::negotiateContentType($supported, $ranking);
41 var_dump($preferred, $ranking);
44 Running this script should give the following output: