Locale::canonicalize
locale_canonicalize
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
Locale::canonicalize -- locale_canonicalize — Canonicalize the locale string
Beschreibung
Canonicalizes the passed locale string to ICU format.
This does not necessarily indicate or return a valid locale. It is only a
version of the input that has been canonicalized according to ICU rules.
The behavior of this function depends on the version of ICU PHP is using
(INTL_ICU_VERSION).
Parameter-Liste
locale
-
Original locale string.
Rückgabewerte
Canonicalized locale string.
Gibt null zurück, wenn die Länge von locale INTL_MAX_LOCALE_LEN überschreitet.
Beispiele
Beispiel #1 locale_canonicalize() example
echo Locale::canonicalize('en-US.utf8') . "\n";
echo Locale::canonicalize('totally-not-valid') . "\n";
Das oben gezeigte Beispiel erzeugt
eine ähnliche Ausgabe wie: