3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $sdate = "2017-06-19"; $edate = "2017-08-21"; $ts1 = strtotime($sdate); $ts2 = strtotime($edate); $year1 = date('Y', $ts1); $year2 = date('Y', $ts2); $month1 = date('m', $ts1); $month2 = date('m', $ts2); $diff = (($year2 - $year1) * 12) + ($month2 - $month1); echo $diff; for($i=1; $i<=$diff; $i++) { $time = strtotime($sdate); $final = date("Y-m-d", strtotime("+1 month", $time)); echo $final ."\n"; //$sql = mysqli_query($con, "SUPPORT REQUEST QUERY"); }
based on 9FOZt
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.3.0beta1
22017-07-19 2017-07-19