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