Bitrix Site Manager

GetCountryArray

array
GetCountryArray(
 string language_id = LANGUAGE_ID
)

The function GetCountryArray returns an array of countries whose names are returned in the specified language. The array is returned in format allowing to pass it to functions SelectBoxFromArray, SelectBoxMFromArray without additional processing.

Note
Array of countries is specified in files /bitrix/modules/main/lang/language_id/tools.php.

Parameters

ParameterDescription
language_id The ID of the language in which the countries names are to be returned.
Optional. The default value is LANGUAGE_ID (current).

Example of a returned array


Array
(
    [reference_id] => Array
        (
            [0] => 16
            [1] => 17
            [2] => 2
            [3] => 18
            ...
        ),
    [reference] => Array
        (
            [0] => Australia
            [1] => Austria
            [2] => Azerbaijan
            [3] => Albania
            ...
        )
)

Example:


<?
// display a drop-down list of countries
echo SelectBoxFromArray(
	"COUNTRY_ID", 
	GetCountryArray(), 
	$COUNTRY_ID, 
	"< select country >"
	);
?>