Skip to content

Commit 5ada953

Browse files
author
Ben Ramsey
committed
Adding an example for the quality method.
1 parent 7c74da9 commit 5ada953

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ $mimeType = \Bitworking\Mimeparse::bestMatch($supportedTypes, $httpAcceptHeader)
2828
echo $mimeType; // Should echo "text/xml"
2929
```
3030

31+
You may also use Mimeparse to get the quality value of a specific media type
32+
when compared against a range of media types (from the Accept header, for example).
33+
34+
```php
35+
<?php
36+
$httpAcceptHeader = 'text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, *\/*;q=0.5';
37+
$quality = \Bitworking\Mimeparse::quality('text/html', $httpAcceptHeader);
38+
echo $quality; // Should echo 0.7
39+
```
40+
3141

3242
[http-accept]: http://tools.ietf.org/html/rfc2616#section-14.1
3343
[http]: http://tools.ietf.org/html/rfc2616

0 commit comments

Comments
 (0)