PHP Array Of All Languages Name And Code

List of all languages name and code for PHP Array

Languages Name And Code For PHP Array Object

Select only the languages name for which you want to create the PHP array or object.

#Language NameCodeNative NameSelect
Selected 164
Change array object key name | Move columns (for table)
Select array type:
PHP
<?php 
// count 142
$languages_list = array(
    'af' => 'Afrikaans',
	'sq' => 'Albanian - shqip',
	'am' => 'Amharic - አማርኛ',
	'ar' => 'Arabic - العربية',
	'an' => 'Aragonese - aragonés',
	'hy' => 'Armenian - հայերեն',
	'ast' => 'Asturian - asturianu',
	'az' => 'Azerbaijani - azərbaycan dili',
	'eu' => 'Basque - euskara',
	'be' => 'Belarusian - беларуская',
	'bn' => 'Bengali - বাংলা',
	'bs' => 'Bosnian - bosanski',
	'br' => 'Breton - brezhoneg',
	'bg' => 'Bulgarian - български',
	'ca' => 'Catalan - català',
	'ckb' => 'Central Kurdish - کوردی (دەستنوسی عەرەبی)',
	'zh' => 'Chinese - 中文',
	'zh-HK' => 'Chinese (Hong Kong) - 中文(香港)',
	'zh-CN' => 'Chinese (Simplified) - 中文(简体)',
	'zh-TW' => 'Chinese (Traditional) - 中文(繁體)',
	'co' => 'Corsican',
	'hr' => 'Croatian - hrvatski',
	'cs' => 'Czech - čeština',
	'da' => 'Danish - dansk',
	'nl' => 'Dutch - Nederlands',
	'en' => 'English',
	'en-AU' => 'English (Australia)',
	'en-CA' => 'English (Canada)',
	'en-IN' => 'English (India)',
	'en-NZ' => 'English (New Zealand)',
	'en-ZA' => 'English (South Africa)',
	'en-GB' => 'English (United Kingdom)',
	'en-US' => 'English (United States)',
	'eo' => 'Esperanto - esperanto',
	'et' => 'Estonian - eesti',
	'fo' => 'Faroese - føroyskt',
	'fil' => 'Filipino',
	'fi' => 'Finnish - suomi',
	'fr' => 'French - français',
	'fr-CA' => 'French (Canada) - français (Canada)',
	'fr-FR' => 'French (France) - français (France)',
	'fr-CH' => 'French (Switzerland) - français (Suisse)',
	'gl' => 'Galician - galego',
	'ka' => 'Georgian - ქართული',
	'de' => 'German - Deutsch',
	'de-AT' => 'German (Austria) - Deutsch (Österreich)',
	'de-DE' => 'German (Germany) - Deutsch (Deutschland)',
	'de-LI' => 'German (Liechtenstein) - Deutsch (Liechtenstein)',
	'de-CH' => 'German (Switzerland) - Deutsch (Schweiz)',
	'el' => 'Greek - Ελληνικά',
	'gn' => 'Guarani',
	'gu' => 'Gujarati - ગુજરાતી',
	'ha' => 'Hausa',
	'haw' => 'Hawaiian - ʻŌlelo Hawaiʻi',
	'he' => 'Hebrew - עברית',
	'hi' => 'Hindi - हिन्दी',
	'hu' => 'Hungarian - magyar',
	'is' => 'Icelandic - íslenska',
	'id' => 'Indonesian - Indonesia',
	'ia' => 'Interlingua',
	'ga' => 'Irish - Gaeilge',
	'it' => 'Italian - italiano',
	'it-IT' => 'Italian (Italy) - italiano (Italia)',
	'it-CH' => 'Italian (Switzerland) - italiano (Svizzera)',
	'ja' => 'Japanese - 日本語',
	'kn' => 'Kannada - ಕನ್ನಡ',
	'kk' => 'Kazakh - қазақ тілі',
	'km' => 'Khmer - ខ្មែរ',
	'ko' => 'Korean - 한국어',
	'ku' => 'Kurdish - Kurdî',
	'ky' => 'Kyrgyz - кыргызча',
	'lo' => 'Lao - ລາວ',
	'la' => 'Latin',
	'lv' => 'Latvian - latviešu',
	'ln' => 'Lingala - lingála',
	'lt' => 'Lithuanian - lietuvių',
	'mk' => 'Macedonian - македонски',
	'ms' => 'Malay - Bahasa Melayu',
	'ml' => 'Malayalam - മലയാളം',
	'mt' => 'Maltese - Malti',
	'mr' => 'Marathi - मराठी',
	'mn' => 'Mongolian - монгол',
	'ne' => 'Nepali - नेपाली',
	'no' => 'Norwegian - norsk',
	'nb' => 'Norwegian Bokmål - norsk bokmål',
	'nn' => 'Norwegian Nynorsk - nynorsk',
	'oc' => 'Occitan',
	'or' => 'Oriya - ଓଡ଼ିଆ',
	'om' => 'Oromo - Oromoo',
	'ps' => 'Pashto - پښتو',
	'fa' => 'Persian - فارسی',
	'pl' => 'Polish - polski',
	'pt' => 'Portuguese - português',
	'pt-BR' => 'Portuguese (Brazil) - português (Brasil)',
	'pt-PT' => 'Portuguese (Portugal) - português (Portugal)',
	'pa' => 'Punjabi - ਪੰਜਾਬੀ',
	'qu' => 'Quechua',
	'ro' => 'Romanian - română',
	'mo' => 'Romanian (Moldova) - română (Moldova)',
	'rm' => 'Romansh - rumantsch',
	'ru' => 'Russian - русский',
	'gd' => 'Scottish Gaelic',
	'sr' => 'Serbian - српски',
	'sh' => 'Serbo-Croatian - Srpskohrvatski',
	'sn' => 'Shona - chiShona',
	'sd' => 'Sindhi',
	'si' => 'Sinhala - සිංහල',
	'sk' => 'Slovak - slovenčina',
	'sl' => 'Slovenian - slovenščina',
	'so' => 'Somali - Soomaali',
	'st' => 'Southern Sotho',
	'es' => 'Spanish - español',
	'es-AR' => 'Spanish (Argentina) - español (Argentina)',
	'es-419' => 'Spanish (Latin America) - español (Latinoamérica)',
	'es-MX' => 'Spanish (Mexico) - español (México)',
	'es-ES' => 'Spanish (Spain) - español (España)',
	'es-US' => 'Spanish (United States) - español (Estados Unidos)',
	'su' => 'Sundanese',
	'sw' => 'Swahili - Kiswahili',
	'sv' => 'Swedish - svenska',
	'tg' => 'Tajik - тоҷикӣ',
	'ta' => 'Tamil - தமிழ்',
	'tt' => 'Tatar',
	'te' => 'Telugu - తెలుగు',
	'th' => 'Thai - ไทย',
	'ti' => 'Tigrinya - ትግርኛ',
	'to' => 'Tongan - lea fakatonga',
	'tr' => 'Turkish - Türkçe',
	'tk' => 'Turkmen',
	'tw' => 'Twi',
	'uk' => 'Ukrainian - українська',
	'ur' => 'Urdu - اردو',
	'ug' => 'Uyghur',
	'uz' => 'Uzbek - o‘zbek',
	'vi' => 'Vietnamese - Tiếng Việt',
	'wa' => 'Walloon - wa',
	'cy' => 'Welsh - Cymraeg',
	'fy' => 'Western Frisian',
	'xh' => 'Xhosa',
	'yi' => 'Yiddish',
	'yo' => 'Yoruba - Èdè Yorùbá',
	'zu' => 'Zulu - isiZulu'
);
?>

Create a list of HTML drop-down languages using PHP array

This is a auto-generated code for drop-down list. It depends on the type of array you created.
Click on the download button below to download the entire code, including PHP array list.
PHP
<?php 
// include array
require ('./languages-array.php');

function languages_dropdown($user_language_code='') {
	$option = "";
	$selected ='';
	foreach ($GLOBALS['languages_list'] as $key => $value) {
		$selected = ($key == $user_language_code ? ' selected' : '');
		$option .= '<option value="'.$key.'"'.$selected.'>'.$value.'</option>'."\n";
	}
	return $option;
}
?>

<select id="languages" name="languages">
    <option>select languages</option>
    <?php 
    // user language code for selected option
    $user_language = 'en';
    echo languages_dropdown($user_language);
    ?>
</select>

Create a Table of language names using a PHP languages array.

This is a auto-generated code for HTML table. It depends on the type of array you created.
Click on the download button below to download the entire code, including the style and array list.
PHP
<?php 
// include array
require ('./languages-array.php');

function languages_table() {
    $table = '';
    foreach ($GLOBALS['languages_list'] as $key => $value) {
        $table .= '<tr>';
        $table .= '<td>'.$value.'</td>';
        $table .= '<td>'.$key.'</td>';
        $table .= '</tr>'."\n";
    }
    return $table;
}
?>

<table class="mytable">
    <thead>
        <tr>
            <th>name</th> <th>code</th>
        </tr>
    </thead>
    <tbody id="table-languages">
    <?php echo languages_table(); ?>
    </tbody>
</table>

PHP Array Languages Code

This PHP array code is used to verify the language code chosen by the user.
Example:
<?php 
$user_selected_code = "en";
if(!in_array($user_selected_code, $languages_code)){
    echo 'invalid code';
    return;
}
PHP
<?php 
$languages_code = array(
'af', 'sq', 'am', 'ar', 'an', 'hy', 'ast', 'az', 'eu', 'be', 'bn', 'bs', 'br', 'bg', 'ca', 'ckb', 'zh', 'zh-HK', 'zh-CN', 'zh-TW', 'co', 'hr', 'cs', 'da', 'nl', 'en', 'en-AU', 'en-CA', 'en-IN', 'en-NZ', 'en-ZA', 'en-GB', 'en-US', 'eo', 'et', 'fo', 'fil', 'fi', 'fr', 'fr-CA', 'fr-FR', 'fr-CH', 'gl', 'ka', 'de', 'de-AT', 'de-DE', 'de-LI', 'de-CH', 'el', 'gn', 'gu', 'ha', 'haw', 'he', 'hi', 'hu', 'is', 'id', 'ia', 'ga', 'it', 'it-IT', 'it-CH', 'ja', 'kn', 'kk', 'km', 'ko', 'ku', 'ky', 'lo', 'la', 'lv', 'ln', 'lt', 'mk', 'ms', 'ml', 'mt', 'mr', 'mn', 'ne', 'no', 'nb', 'nn', 'oc', 'or', 'om', 'ps', 'fa', 'pl', 'pt', 'pt-BR', 'pt-PT', 'pa', 'qu', 'ro', 'mo', 'rm', 'ru', 'gd', 'sr', 'sh', 'sn', 'sd', 'si', 'sk', 'sl', 'so', 'st', 'es', 'es-AR', 'es-419', 'es-MX', 'es-ES', 'es-US', 'su', 'sw', 'sv', 'tg', 'ta', 'tt', 'te', 'th', 'ti', 'to', 'tr', 'tk', 'tw', 'uk', 'ur', 'ug', 'uz', 'vi', 'wa', 'cy', 'fy', 'xh', 'yi', 'yo', 'zu'
);
?>