Чтобы вычесть дату из сегодняшнего дня в PHP, вы можете использовать различные методы. Вот несколько примеров:
Метод 1: использование класса DateTime и метода diff():
$today = new DateTime();
$otherDate = new DateTime('2023-12-31');
$interval = $today->diff($otherDate);
$daysDifference = $interval->days;
echo $daysDifference; // Output: Number of days between today and the other date
Метод 2. Использование функции strtotime():
$today = time();
$otherDate = strtotime('2023-12-31');
$secondsDifference = $otherDate - $today;
$daysDifference = floor($secondsDifference / (60 * 60 * 24));
echo $daysDifference; // Output: Number of days between today and the other date
Метод 3. Использование функции date_diff():
$today = date_create();
$otherDate = date_create('2023-12-31');
$interval = date_diff($today, $otherDate);
$daysDifference = $interval->format('%a');
echo $daysDifference; // Output: Number of days between today and the other date
Эти методы рассчитают количество дней между сегодняшней датой и указанной датой. Вы можете выбрать метод, соответствующий вашим требованиям.