Locale::getPrimaryLanguage

(PHP 5 >= 5.3.0, PHP 7, PECL intl >= 1.0.0)
Gets the primary language for the input locale
public static string Locale::getPrimaryLanguage ( string $locale )

Object oriented style

Procedural style

string locale_get_primary_language ( string $locale )

Gets the primary language for the input locale

Parameters:
locale

The locale to extract the primary language code from

Returns:

The language code associated with the language or NULL in case of error.

Examples:
locale_get_primary_language() example
<?php
echo locale_get_primary_language('zh-Hant');
?>

OO example
<?php
echo Locale::getPrimaryLanguage('zh-Hant');
?>

See also:

locale_get_script() -

locale_get_region() -

locale_get_all_variants() -

doc_php
2016-02-24 15:57:25
Comments
Leave a Comment

Please login to continue.