How can the PHP date function be used to determine the day of the week for a specific date?

To determine the day of the week for a specific date using the PHP date function, you can use the "l" format character which will return the full name of the day of the week. This format character can be combined with the date function to get the desired result.

$date = "2022-01-01";
$day_of_week = date("l", strtotime($date));
echo "The day of the week for " . $date . " is: " . $day_of_week;