I have 2 dates in PHP, how can I run a for or foreach loop to loop through each day and add +3 days to each?
below I add an example of how I want to get the listing.
<?php
$begin = new DateTime( "2022-01-01" );
$end = new DateTime( "2022-01-31" );
for($i=$begin; $i<=$end; $i->modify('+1 day')){
for($j=$begin; $j<=$end; $j->modify('+3 day')){
echo $i->format("M d, Y").' => ';
echo $j->format("M d, Y").'<br/><br/>';
/* I WANTS TO GET
* Jan 01, 2022 => Jan 04, 2022
* Jan 02, 2022 => Jan 05, 2022
* Jan 03, 2022 => Jan 06, 2022
*...
*...
* Jan 31, 2022 => Feb 03, 2022
*/
}
}
?>