PHP code example of ryantxr / browser-preferred-lang

1. Go to this page and download the library: Download ryantxr/browser-preferred-lang 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/ */

    

ryantxr / browser-preferred-lang example snippets


use Ryantxr\BrowserPreferredLang\PreferredLang;
$p = new PreferredLang;
$langs = $p->get(['en', 'zh-cn', 'es'], $_SERVER['HTTP_ACCEPT_LANGUAGE']);
print_r($langs);