$locales = Locale::getAllLocales(); foreach ($locales as $locale) { echo "
$locale = 'en_US'; $locales = Locale::getAllLocales(); if (in_array($locale, $locales)) { echo "$locale is available."; } else { echo "$locale is not available."; }
$locales = Locale::getAllLocales(); $filteredLocales = array_filter($locales, function($locale) { return preg_match('/^en_/', $locale); });Package library: `intl` The `Locale` class is part of the `intl` extension, which is a built-in package in PHP. The extension provides functions and classes for working with internationalization and localization.