3v4l.org

run code in 300+ PHP versions simultaneously
<?php $startDate = '2017-03-31'; $endDate = '2017-05-14'; $fromDate = explode("-", $startDate); $toDate = explode("-", $endDate); $start = new DateTime($startDate); $end = new DateTime($endDate); $interval = DateInterval::createFromDateString('1 month'); $period = new DatePeriod($start, $interval, $end); //print_r($interval); foreach ($period as $dt) { $date = $dt->format("Y-m-d"); print $date.'<br>'; $firstDate = $date."-15"; $secondDate = $date."-28"; if((strtotime($endDate) >= strtotime($firstDate)) && (strtotime($startDate) <= strtotime($firstDate))) $res[] = $firstDate; if((strtotime($endDate) >= strtotime($secondDate)) && (strtotime($startDate) <= strtotime($secondDate))) $res[] = $secondDate; } print_r($res);
Output for git.master, git.master_jit, rfc.property-hooks
2017-03-31<br>2017-05-01<br>Array ( [0] => 2017-03-31-15 [1] => 2017-03-31-28 [2] => 2017-05-01-15 [3] => 2017-05-01-28 )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
90.74 ms | 401 KiB | 8 Q