What are some best practices for formatting dates in PHP to display as day.month.year?

When formatting dates in PHP to display as day.month.year, it's important to use the correct formatting characters to ensure the date is displayed in the desired format. One common way to achieve this is by using the date() function in PHP with the 'd.m.Y' format string, where 'd' represents the day, 'm' represents the month, and 'Y' represents the year.

$date = "2022-10-15";
$formatted_date = date('d.m.Y', strtotime($date));
echo $formatted_date;