php8.5
Home/ Manual/ intl / locale/ Locale::getAllVariants

Locale::getAllVariants

PHP function Edit on GitHub ✎

(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)

Gets the variants for the input locale

Description

Oop

Locale::getAllVariants(string $locale): array|null

Procedural

locale_get_all_variants(string $locale): array|null

Gets the variants for the input locale

Parameters

locale

The locale to extract the variants from

Return Values

The array containing the list of all variants subtag for the locale or null if not present

Return

Examples

locale_get_all_variants() example

php
<?php
$arr = locale_get_all_variants('sl_IT_NEDIS_ROJAZ_1901');
var_export( $arr );
?>

OO example

php
<?php
 $arr = Locale::getAllVariants('sl_IT_NEDIS_ROJAZ_1901');
 var_export( $arr );
?>

The above example will output:

output
array (
    0 => 'NEDIS',
    1 => 'ROJAZ',
    2 => '1901',
)

See Also

Source: reference/intl/locale/get-all-variants.xml · from the official PHP manual (php/doc-en)