What are the best practices for creating a function in PHP to handle phone redirection based on holidays and an array of phone numbers?

When handling phone redirection based on holidays and an array of phone numbers in PHP, it is best practice to create a function that checks if it is a holiday and redirects the call accordingly. This function should take into account the current date, the list of holidays, and the array of phone numbers to determine the appropriate redirection.

function handlePhoneRedirection($phoneNumbers, $holidays) {
    $currentDate = date('Y-m-d');
    
    if (in_array($currentDate, $holidays)) {
        // Redirect to a specific phone number for holidays
        $redirectPhoneNumber = '1234567890';
    } else {
        // Redirect to the next phone number in the array
        $redirectPhoneNumber = current($phoneNumbers);
        next($phoneNumbers);
    }
    
    // Perform the actual phone redirection here
    echo "Redirecting call to: " . $redirectPhoneNumber;
}

// Usage example
$phoneNumbers = ['1111111111', '2222222222', '3333333333'];
$holidays = ['2022-01-01', '2022-12-25'];

handlePhoneRedirection($phoneNumbers, $holidays);