datetime php difference in days

PHP
<?php 
// PHP program to add days to $Date 
  
// Declare a date 
$date = "2019-05-10"; 
  
// Add days to date and display it 
echo date('Y-m-d', strtotime($date. ' + 10 days')); 
  
?> // add 1 day to the date above
$n = date('Y-m-d', strtotime( $d . " +1 days"));

// add 1 month to the date above
$n = date('Y-m-d', strtotime( $d . " +1 month"));

// add 1 year to the date above
$n = date('Y-m-d', strtotime( $d . " +1 year"));

// subtract 1 day to the date above
$n = date('Y-m-d', strtotime( $d . " -1 days"));

// subtract 1 month to the date above
$n = date('Y-m-d', strtotime( $d . " -1 month"));

// subtract 1 year to the date above
$n = date('Y-m-d', strtotime( $d . " -1 year"));
Source

Also in PHP: