What function in PHP can be used to work with timestamps for date comparison?

To work with timestamps for date comparison in PHP, you can use the `strtotime()` function to convert a date/time string into a Unix timestamp. This allows you to easily compare dates by converting them into a common format for comparison.

$date1 = strtotime('2022-01-01');
$date2 = strtotime('2022-12-31');

if ($date1 < $date2) {
    echo "Date 1 is before Date 2";
} elseif ($date1 > $date2) {
    echo "Date 1 is after Date 2";
} else {
    echo "Date 1 is the same as Date 2";
}