How can PHP be used to differentiate between holidays that count as full days off versus those that count as half days off?

To differentiate between holidays that count as full days off versus those that count as half days off in PHP, you can create an array that lists the holidays and specifies whether they are full days off or half days off. Then, you can use conditional statements to check if a specific holiday is in the array and determine its type of day off.

// Array of holidays with their corresponding day off type
$holidays = [
    'Christmas' => 'full day off',
    'New Year' => 'half day off',
    'Thanksgiving' => 'full day off'
];

// Check if a specific holiday is in the array and determine its day off type
$holiday = 'New Year';
if(array_key_exists($holiday, $holidays)) {
    echo $holiday . ' is a ' . $holidays[$holiday];
} else {
    echo $holiday . ' is not a holiday';
}