How can HTML code be used to highlight dates in a PHP calendar?

To highlight dates in a PHP calendar using HTML code, you can add a CSS class to the date cells that you want to highlight. This can be done by checking the date in your PHP code and adding a specific class attribute to the corresponding HTML element.

```php
// Sample PHP code to generate a calendar with highlighted dates
$highlightedDates = array("2022-01-10", "2022-01-15", "2022-01-20");

function generateCalendar($highlightedDates) {
    $output = '<table>';
    // Generate calendar cells
    // Check if date is in the highlightedDates array and add a class if true
    foreach ($daysInMonth as $day) {
        if (in_array($day, $highlightedDates)) {
            $output .= '<td class="highlighted">' . $day . '</td>';
        } else {
            $output .= '<td>' . $day . '</td>';
        }
    }
    $output .= '</table>';
    return $output;
}

echo generateCalendar($highlightedDates);
```

In the above code snippet, we define an array of highlighted dates and then use a function to generate a calendar with the specified dates highlighted by adding a CSS class "highlighted" to those date cells. This way, you can easily customize the appearance of specific dates in your PHP calendar using HTML and CSS.