month adding problem
<?php
$showMonthsQty = 3;
for($i = (1-$showMonthsQty); $i <= 0; $i++)
{
echo $date = date("Y-m-1", strtotime(" +$i months"));
}
?>
when it run's im not geting the desired answer.
OUTPUT
2018-03-1
2018-05-1 <----------error
2018-05-1
but i needed output is :
2018-03-1
2018-04-1
2018-05-1
how can i get this ?pls help!... tnx in advance...:)