PHP code example of zozlak / http-accept

1. Go to this page and download the library: Download zozlak/http-accept library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zozlak / http-accept example snippets


$bestMatch = zozlak\HttpAccept::getBestMatch(['application/json', 'application/xml']);
echo (string) $bestMatch . "\n";
// e.g. for an Accept header of
//   text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
// you will get `application/xml;q=0.9`