PHP code example of supportpal / accept-language-parser

1. Go to this page and download the library: Download supportpal/accept-language-parser 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/ */

    

supportpal / accept-language-parser example snippets


$parser = new \SupportPal\AcceptLanguageParser\Parser($_SERVER['http_accept_language']);
foreach ($parser->parse() as $component) {
    echo $component->code();
}

$parser = new \SupportPal\AcceptLanguageParser\Parser('en-GB;q=0.8');
foreach ($parser->pick(array('en')) as $component) {
    echo $component->code();
}