How can the IntlDateFormatter class be used in PHP to format dates in different languages?

The IntlDateFormatter class in PHP can be used to format dates in different languages by specifying the desired locale when creating an instance of the class. This allows you to display dates in a format that is appropriate for the specified language and region.

$locale = 'fr_FR'; // French locale
$date = new DateTime('2022-01-15');
$formatter = new IntlDateFormatter($locale, IntlDateFormatter::MEDIUM, IntlDateFormatter::NONE);
echo $formatter->format($date);