Documentation

GetCountryArray

array
GetCountryArray(
 string language_id = LANGUAGE_ID
)

The function returns an array of countries which names are returned in the specified language. Format of returned array allows to use it in the SelectBoxFromArray and SelectBoxMFromArray functions without additional processing.

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

Function parameters

ParameterDescription
language_id The ID of the language in which the countries names are to be returned.
Optional parameter. The default value is [link=6658210#language_id]LANGUAGE_ID[/link] (current language).

Examples of 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 of use:

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


© «Bitrix24», 2001-2022
Up