What best practices should be followed when dealing with duplicate calendar weeks in a year while calculating Unix timestamps in PHP?

When dealing with duplicate calendar weeks in a year, it is important to ensure that the Unix timestamps are calculated accurately to avoid any discrepancies. One way to handle this issue is by adjusting the week number calculation to account for the duplicates. This can be done by checking if the current week number is greater than 52 and if the current month is January, in which case the week number should be set to 53.

// Get the current week number
$weekNumber = date('W');

// Check if the current week number is greater than 52 and if the current month is January
if ($weekNumber > 52 && date('n') == 1) {
    $weekNumber = 53;
}

// Calculate the Unix timestamp using the adjusted week number
$timestamp = strtotime(date('Y') . 'W' . $weekNumber);