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

Locale::setDefault

PHP function Edit on GitHub ✎

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

Sets the default runtime locale

Description

Oop

Locale::setDefault(string $locale): true

Procedural

locale_set_default(string $locale): true

Sets the default runtime locale to locale. This changes the value of INTL global 'default_locale' locale identifier. UAX #35 extensions are accepted.

Parameters

locale

Is a BCP 47 compliant language tag.

Return Values

Returns true.

Examples

locale_set_default() example

php
<?php
locale_set_default('de-DE');
echo locale_get_default();
?>

OO example

php
<?php
Locale::setDefault('de-DE');
echo Locale::getDefault();
?>

The above example will output:

output
de-DE

See Also

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