Are there any best practices for handling calendar week calculations in PHP to avoid issues with year transitions?

When calculating calendar weeks in PHP, it's important to consider the transition between years, as the last week of December may spill over into the first week of January. To handle this, you can use the `W` date format character in PHP, which returns the ISO-8601 week number of a given date.

// Get the calendar week number for a given date
function getCalendarWeek($date) {
    $weekNumber = date('W', strtotime($date));
    return $weekNumber;
}

// Example usage
$weekNumber = getCalendarWeek('2023-01-01');
echo "Calendar week number: " . $weekNumber;