What is the purpose of the `setlocale()` function in PHP and how can it be used to output month names in different languages?
The `setlocale()` function in PHP is used to set the locale information, such as language, region, and character encoding. By setting the appropriate locale, we can output month names in different languages. To output month names in a specific language, we can use `strftime()` function with the `%B` format specifier to get the full month name according to the set locale.
// Set the locale to French
setlocale(LC_TIME, 'fr_FR.UTF-8');
// Output the current month in French
echo strftime('%B');